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"
- GUI_TK_LIBRARY="$GUI_TK_LIBRARY \$MICROWIN/src/lib/libnano-X.a \$MICROWIN/src/lib/libmwengine.a \$MICROWIN/src/lib/libmwfonts.a \$MICROWIN/src/lib/libmwdrivers.a"
+ GUI_TK_LIBRARY="$GUI_TK_LIBRARY \$(MICROWIN)/src/lib/libnano-X.a"
else
GUI_TK_LIBRARY="$GUI_TK_LIBRARY -lX11$xpm_link"
fi
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"
- GUI_TK_LIBRARY="$GUI_TK_LIBRARY \$MICROWIN/src/lib/libnano-X.a \$MICROWIN/src/lib/libmwengine.a \$MICROWIN/src/lib/libmwfonts.a \$MICROWIN/src/lib/libmwdrivers.a"
+ GUI_TK_LIBRARY="$GUI_TK_LIBRARY \$(MICROWIN)/src/lib/libnano-X.a"
else
GUI_TK_LIBRARY="$GUI_TK_LIBRARY -lX11$xpm_link"
fi
underlying port uses the Windows ports with small modifications
for the MicroWindows API.
+=== NOTE: ===
+
+ Current efforts are being concentrated on a port to Nano-X,
+ which potentially offers greater flexibility than the WIN32
+ API of MicroWindows, such as the ability to run multiple
+ Nano-X processes simultaneously. Please see
+ ../docs/x11/readme-nanox.txt for information.
+
There are many things missing from MicroWindows that will
-make the port quite limited for the time being. I haven't
-worked out how to create bitmaps, though there is a BMP to C
-converter. There are no common dialogs (we will use generic ones),
-and only one WIN32 app may be run at a time.
+make the port quite limited for the time being.
+In particular, only one WIN32 app may be run at a time.
Note that you can gain confidence in the WIN32/wxUniversal
combination by compiling wxUniversal under Windows using VC++,
-using src/wxvc_universal.dsp. You can compile the minimal
+using src/wxUniv.dsp. You can compile the minimal
and widgets samples in wxUniversal mode using the
UnivDebug and UnivRelease targets. Most of the code is shared
between this combination, and the wxMicroWindows port.
void SetConstraints( wxLayoutConstraints *constraints );
wxLayoutConstraints *GetConstraints() const { return m_constraints; }
- // when using constraints, it makes sense to update children positions
- // automatically whenever the window is resized - this is done if
- // autoLayout is on
- void SetAutoLayout( bool autoLayout ) { m_autoLayout = autoLayout; }
- bool GetAutoLayout() const { return m_autoLayout; }
-
- // do layout the window and its children
- virtual bool Layout();
-
// implementation only
void UnsetConstraints(wxLayoutConstraints *c);
wxWindowList *GetConstraintsInvolvedIn() const
virtual void GetClientSizeConstraint(int *w, int *h) const ;
virtual void GetPositionConstraint(int *x, int *y) const ;
+#endif // wxUSE_CONSTRAINTS
+
+ // when using constraints or sizers, it makes sense to update
+ // children positions automatically whenever the window is resized
+ // - this is done if autoLayout is on
+ void SetAutoLayout( bool autoLayout ) { m_autoLayout = autoLayout; }
+ bool GetAutoLayout() const { return m_autoLayout; }
+
+ // lay out the window and its children
+ virtual bool Layout();
+
// sizers
void SetSizer( wxSizer *sizer );
wxSizer *GetSizer() const { return m_windowSizer; }
void SetContainingSizer(wxSizer* sizer) { m_containingSizer = sizer; }
wxSizer *GetContainingSizer() const { return m_containingSizer; }
-#endif // wxUSE_CONSTRAINTS
-
// backward compatibility
// ----------------------
#if WXWIN_COMPATIBILITY
// constraints this window is involved in
wxWindowList *m_constraintsInvolvedIn;
+#endif // wxUSE_CONSTRAINTS
// this window's sizer
wxSizer *m_windowSizer;
// Layout() window automatically when its size changes?
bool m_autoLayout:1;
-#endif // wxUSE_CONSTRAINTS
// window state
bool m_isShown:1;
#ifndef _DUMMY_XLIBH_
#define _DUMMY_XLIBH_
+#ifdef __GNUG__
+ #pragma interface "Xlib.h"
+#endif
+
/* Move away the typedef in XtoNX.h */
#define XFontStruct XFontStruct1
#include <XtoNX.h>
typedef unsigned long VisualID;
typedef int Bool;
typedef long XID;
-typedef XID KeySym;
+typedef GR_SCANCODE KeySym;
+typedef GR_EVENT_KEYSTROKE XKeyEvent;
typedef struct {
GR_FONT_INFO info;
GR_FONT_ID fid;
unsigned short attributes; /* per char flags (not predefined) */
} XCharStruct;
+/* Configure window value mask bits */
+#define CWX (1<<0)
+#define CWY (1<<1)
+#define CWWidth (1<<2)
+#define CWHeight (1<<3)
+#define CWBorderWidth (1<<4)
+#define CWSibling (1<<5)
+#define CWStackMode (1<<6)
+
+/* Values */
+
+typedef struct {
+ int x, y;
+ int width, height;
+ int border_width;
+ Window sibling;
+ int stack_mode;
+} XWindowChanges;
/* typedef unsigned long Time; */
#define DoRed 0
#define DoGreen 0
#define DoBlue 0
+#define NoEventMask GR_EVENT_MASK_NONE
+#define RevertToParent 0
+#define CurrentTime 0
+#define GrabModeAsync 0
#define GXcopy GR_MODE_COPY
#define GXclear GR_MODE_CLEAR
#define XSynchronize(display,sync)
#define XDefaultRootWindow(d) GR_ROOT_WINDOW_ID
+#define RootWindowOfScreen(s) GR_ROOT_WINDOW_ID
#define XFreePixmap(d, p) GrDestroyWindow(p)
#define XFreeCursor(d, c) GrDestroyCursor(c)
#define XFreeGC(d, gc) GrDestroyGC(gc)
#define XSetBackground(d, gc, c) GrSetGCBackground(gc, c)
#define DefaultVisual(d, s) ((Visual*) NULL)
#define DefaultColormap(d, s) DefaultColormapOfScreen((Screen*) NULL)
+#define DefaultScreenOfDisplay(d) 0
#define XSetFillStyle(d, gc, s) wxNoop()
#define XSetLineAttributes(d, gc, a, b, c, e) wxNoop()
#define XSetClipMask(d, gc, m) wxNoop()
#define XClipBox(r, rect) GrGetRegionBox(r, rect)
#define XPointInRegion(r, x, y) GrPointInRegion(r, x, y)
#define XXorRegion(sr1, sr2, r) GrXorRegion(r, sr1, sr2)
-
+/* TODO: Cannot find equivalent for this. */
+#define XIconifyWindow(d, w, s) 0
+#define XCreateWindowWithColor(d,p,x,y,w,h,bw,depth,cl,vis,backColor,foreColor) \
+ GrNewWindow(p,x,y,w,h,bw,backColor,foreColor)
+#define XLookupString(event, buf, len, sym, status) (*sym = (event)->scancode)
+#define XBell(a, b) GrBell()
+#define DisplayWidthMM(d, s) 100
+#define DisplayHeightMM(d, s) 100
/* These defines are wrongly defined in XtoNX.h, IMHO,
* since they reference a static global.
/* Fuunctions */
-#ifdef __cpluplus
+#ifdef __cplusplus
extern "C" {
#endif
+Display *XOpenDisplay(char *name);
Colormap DefaultColormapOfScreen(Screen* /* screen */) ;
int XSetGraphicsExposures( Display* /* display */, GC /* gc */, Bool /* graphics_exposures */) ;
int XWarpPointer( Display* /* display */, Window /* srcW */, Window /* destW */,
Bool /* owner_events */, unsigned int /* event_mask */,
int /* pointer_mode */, int /* keyboard_mode */,
Window /* confine_to */, Cursor /* cursor */, Time /* time */) ;
-int XUngrabPointer(Display /* display */, Time /* time */) ;
+int XUngrabPointer(Display* /* display */, Time /* time */) ;
int XCopyArea(Display* /* display */, Drawable src, Drawable dest, GC gc,
int src_x, int src_y, unsigned int width, unsigned int height,
int dest_x, int dest_y) ;
int dest_x, int dest_y, unsigned long /* plane */) ;
XErrorHandler XSetErrorHandler (XErrorHandler /* handler */);
-Display *XOpenDisplay(char *name);
Screen *XScreenOfDisplay(Display* /* display */,
int /* screen_number */);
int DisplayWidth(Display* /* display */, int /* screen */);
XFontStruct* XLoadQueryFont(Display* display, const char* fontSpec);
int XFreeFont(Display* display, XFontStruct* fontStruct);
int XQueryColor(Display* display, Colormap cmap, XColor* color);
+Status XGetWindowAttributes(Display* display, Window w,
+ XWindowAttributes* window_attributes);
+
+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);
-#ifdef __cpluplus
+#ifdef __cplusplus
}
#endif
#if wxUSE_NANOX
#define XEventGetWindow(event) event->general.wid
+#define XEventGetType(event) event->general.type
#define XConfigureEventGetWidth(event) ((int) event->update.width)
#define XConfigureEventGetHeight(event) ((int) event->update.height)
#define XExposeEventGetX(event) event->exposure.x
#define XExposeEventGetY(event) event->exposure.y
#define XExposeEventGetWidth(event) event->exposure.width
#define XExposeEventGetHeight(event) event->exposure.height
+#define XButtonEventGetTime(event) (wxGetLocalTime())
+#define XButtonEventLChanged(event) (event->button.changebuttons & GR_BUTTON_L)
+#define XButtonEventMChanged(event) (event->button.changebuttons & GR_BUTTON_M)
+#define XButtonEventRChanged(event) (event->button.changebuttons & GR_BUTTON_R)
+#define XButtonEventLIsDown(x) ((x)->button.buttons & GR_BUTTON_L)
+#define XButtonEventMIsDown(x) ((x)->button.buttons & GR_BUTTON_M)
+#define XButtonEventRIsDown(x) ((x)->button.buttons & GR_BUTTON_R)
+#define XButtonEventShiftIsDown(x) (x->button.modifiers & MWKMOD_SHIFT)
+#define XButtonEventCtrlIsDown(x) (x->button.modifiers & MWKMOD_CTRL)
+#define XButtonEventAltIsDown(x) (x->button.modifiers & MWKMOD_ALT)
+#define XButtonEventMetaIsDown(x) (x->button.modifiers & MWKMOD_META)
+#define XButtonEventGetX(event) (event->button.x)
+#define XButtonEventGetY(event) (event->button.y)
+#define XKeyEventGetTime(event) (wxGetLocalTime())
+#define XKeyEventGetX(event) (event->keystroke.x)
+#define XKeyEventGetY(event) (event->keystroke.y)
+#define XKeyEventShiftIsDown(x) (x->keystroke.modifiers & MWKMOD_SHIFT)
+#define XKeyEventCtrlIsDown(x) (x->keystroke.modifiers & MWKMOD_CTRL)
+#define XKeyEventAltIsDown(x) (x->keystroke.modifiers & MWKMOD_ALT)
+#define XKeyEventMetaIsDown(x) (x->keystroke.modifiers & MWKMOD_META)
#define XFontStructGetAscent(f) f->info.baseline
+
#else
+
#define XEventGetWindow(event) event->xany.window
+#define XEventGetType(event) event->xany.type
#define XConfigureEventGetWidth(event) event->xconfigure.width
#define XConfigureEventGetHeight(event) event->xconfigure.height
#define XExposeEventGetX(event) event->xexpose.x
#define XExposeEventGetY(event) event->xexpose.y
#define XExposeEventGetWidth(event) event->xexpose.width
#define XExposeEventGetHeight(event) event->xexpose.height
+#define XButtonEventGetTime(event) (event->xbutton.time)
+#define XButtonEventLChanged(event) (event->xbutton.button == Button1)
+#define XButtonEventMChanged(event) (event->xbutton.button == Button2)
+#define XButtonEventRChanged(event) (event->xbutton.button == Button3)
+#define XButtonEventLIsDown(x) ((x)->xbutton.state & Button1Mask)
+#define XButtonEventMIsDown(x) ((x)->xbutton.state & Button2Mask)
+#define XButtonEventRIsDown(x) ((x)->xbutton.state & Button3Mask)
+#define XButtonEventShiftIsDown(x) (x->xbutton.state & ShiftMask)
+#define XButtonEventCtrlIsDown(x) (x->xbutton.state & ControlMask)
+#define XButtonEventAltIsDown(x) (x->xbutton.state & Mod3Mask)
+#define XButtonEventMetaIsDown(x) (x->xbutton.state & Mod1Mask)
+#define XButtonEventGetX(event) (event->xbutton.x)
+#define XButtonEventGetY(event) (event->xbutton.y)
+#define XKeyEventGetTime(event) (event->xkey.time)
+#define XKeyEventShiftIsDown(x) (x->xkey.state & ShiftMask)
+#define XKeyEventCtrlIsDown(x) (x->xkey.state & ControlMask)
+#define XKeyEventAltIsDown(x) (x->xkey.state & Mod3Mask)
+#define XKeyEventMetaIsDown(x) (x->xkey.state & Mod1Mask)
+#define XKeyEventGetX(event) (event->xkey.x)
+#define XKeyEventGetY(event) (event->xkey.y)
#define XFontStructGetAscent(f) f->ascent
#endif
: wxPanel( frame, -1, wxPoint(x, y), wxSize(w, h) ),
m_text(NULL), m_notebook(NULL)
{
- wxLayoutConstraints *c;
-
m_text = new wxTextCtrl(this, -1, "This is the log window.\n",
wxPoint(0, 250), wxSize(100, 50), wxTE_MULTILINE);
m_text->SetBackgroundColour(wxT("wheat"));
m_notebook->AddPage(panel, "wxBitmapXXX");
// layout constraints
+#if wxUSE_CONSTRAINTS
+ wxLayoutConstraints *c;
panel = new wxPanel(m_notebook);
panel->SetAutoLayout( TRUE );
pMyButton2->SetConstraints( c );
m_notebook->AddPage(panel, "wxLayoutConstraint");
-
+#endif
+
// sizer
panel = new wxPanel(m_notebook);
#if wxUSE_CONSTRAINTS
#include "wx/layout.h"
- #include "wx/sizer.h"
#endif // wxUSE_CONSTRAINTS
+#include "wx/sizer.h"
+
#if wxUSE_DRAG_AND_DROP
#include "wx/dnd.h"
#endif // wxUSE_DRAG_AND_DROP
// no constraints whatsoever
m_constraints = (wxLayoutConstraints *) NULL;
m_constraintsInvolvedIn = (wxWindowList *) NULL;
+#endif // wxUSE_CONSTRAINTS
+
m_windowSizer = (wxSizer *) NULL;
m_containingSizer = (wxSizer *) NULL;
m_autoLayout = FALSE;
-#endif // wxUSE_CONSTRAINTS
#if wxUSE_DRAG_AND_DROP
m_dropTarget = (wxDropTarget *)NULL;
m_constraints = NULL;
}
+#endif // wxUSE_CONSTRAINTS
+
if ( m_containingSizer )
m_containingSizer->Remove((wxWindow*)this);
if ( m_windowSizer )
delete m_windowSizer;
-#endif // wxUSE_CONSTRAINTS
-
#if wxUSE_DRAG_AND_DROP
if ( m_dropTarget )
delete m_dropTarget;
m_constraintsInvolvedIn = (wxWindowList *) NULL;
}
}
+#endif
void wxWindowBase::SetSizer(wxSizer *sizer)
{
GetSizer()->SetDimension( 0, 0, w, h );
}
+#if wxUSE_CONSTRAINTS
else
{
wxLayoutConstraints *constr = GetConstraints();
DoPhase(2); // Layout grand children
SetConstraintSizes(); // Recursively set the real window sizes
}
+#endif
return TRUE;
}
-
+#if wxUSE_CONSTRAINTS
// Do a phase of evaluating constraints: the default behaviour. wxSizers may
// do a similar thing, but also impose their own 'constraints' and order the
// evaluation differently.
GetClientSize(w, h);
}
+void wxWindowBase::GetPositionConstraint(int *x, int *y) const
+{
+ wxLayoutConstraints *constr = GetConstraints();
+ if ( constr )
+ {
+ *x = constr->left.GetValue();
+ *y = constr->top.GetValue();
+ }
+ else
+ GetPosition(x, y);
+}
+
+#endif // wxUSE_CONSTRAINTS
+
void wxWindowBase::AdjustForParentClientOrigin(int& x, int& y, int sizeFlags)
{
// don't do it for the dialogs/frames - they float independently of their
}
}
-
-void wxWindowBase::GetPositionConstraint(int *x, int *y) const
-{
- wxLayoutConstraints *constr = GetConstraints();
- if ( constr )
- {
- *x = constr->left.GetValue();
- *y = constr->top.GetValue();
- }
- else
- GetPosition(x, y);
-}
-
-#endif // wxUSE_CONSTRAINTS
-
// ----------------------------------------------------------------------------
// do Update UI processing for child controls
// ----------------------------------------------------------------------------
#pragma hdrstop
#endif
+#if wxUSE_PROLOGIO
+
#include <stdarg.h>
#include <ctype.h>
#include <string.h>
#endif
#endif
+#endif
+ // wxUSE_PROLOGIO
// helpers
// ----------------------------------------------------------------------------
+#if !wxUSE_NANOX
static char **CreateFontList(wxChar spacing,
wxFontEncoding encoding,
int *nFonts)
return TRUE;
}
+#endif
+ // wxUSE_NANOX
// ----------------------------------------------------------------------------
// wxFontEnumerator
bool wxFontEnumerator::EnumerateFacenames(wxFontEncoding encoding,
bool fixedWidthOnly)
{
+#if wxUSE_NANOX
+ return FALSE;
+#else
int nFonts;
char **fonts;
(void)ProcessFamiliesFromFontList(this, fonts, nFonts);
XFreeFontNames(fonts);
-
return TRUE;
+#endif
+ // wxUSE_NANOX
}
bool wxFontEnumerator::EnumerateEncodings(const wxString& family)
{
+#if wxUSE_NANOX
+ return FALSE;
+#else
wxString pattern;
pattern.Printf(wxT("-*-%s-*-*-*-*-*-*-*-*-*-*-*-*"),
family.IsEmpty() ? wxT("*") : family.c_str());
XFreeFontNames(fonts);
return TRUE;
+#endif
+ // wxUSE_NANOX
}
if (displayName.IsEmpty())
xdisplay = XOpenDisplay(NULL);
else
- xdisplay = XOpenDisplay(displayName.c_str());
+ xdisplay = XOpenDisplay((char*) displayName.c_str());
if (!xdisplay)
{
#if wxUSE_NANOX
+#ifdef __GNUG__
+#pragma implementation "Xlib.h"
+#endif
+
#include <ctype.h>
#include <malloc.h>
+#include <string.h>
#include "wx/defs.h"
#include "wx/x11/nanox/X11/Xlib.h"
return Success;
}
-int XUngrabPointer(Display display, Time time)
+int XUngrabPointer(Display* display, Time time)
{
return Success;
}
return 1;
}
+typedef struct {
+ const char* name;
+ unsigned int red;
+ unsigned int green;
+ unsigned int blue;
+} _wxColourEntry;
+
+static _wxColourEntry _wxColourDatabase[] =
+{
+ { "WHITE", 255, 255, 255 },
+ { "BLACK", 0, 0, 0 },
+ { "RED", 255, 0, 0 },
+ { "GREEN", 0, 255, 0 },
+ { "BLUE", 0, 255, 255 },
+ { "GREY", 128, 128, 128 },
+ { "GRAY", 128, 128, 128 },
+ { "LIGHT GREY", 192, 192, 192 },
+ { "LIGHT GRAY", 192, 192, 192 },
+ { "DARK GREY", 32, 32, 32 },
+ { "DARK GRAY", 32, 32, 32 },
+ { "CYAN", 0, 255, 255 },
+ { "MAGENTA", 255, 255, 0 },
+
+ /* TODO: the rest */
+ { NULL, 0, 0, 0 }
+};
+
int XParseColor(Display* display, Colormap cmap,
const char* cname, XColor* color)
{
- /* TODO */
+ int i = 0;
+ for (;;)
+ {
+ if (!_wxColourDatabase[i].name)
+ break;
+ else
+ {
+ if (strcmp(cname, _wxColourDatabase[i].name) == 0)
+ {
+ color->red = _wxColourDatabase[i].red;
+ color->green = _wxColourDatabase[i].green;
+ color->blue = _wxColourDatabase[i].blue;
+
+ return 1;
+ }
+ i ++;
+ }
+ }
+
+ /* Not found: use black */
+ color->red = 0;
+ color->green = 0;
+ color->blue = 0;
+
return 0;
}
return 0;
}
+int XConfigureWindow(Display* display, Window w, int mask, XWindowChanges* changes)
+{
+ if ((mask & CWX) && (mask & CWY))
+ GrMoveWindow(w, changes->x, changes->y);
+ if ((mask & CWWidth) && (mask & CWHeight))
+ GrResizeWindow(w, changes->width, changes->height);
+ if (mask & CWBorderWidth)
+ {
+ /* TODO */
+ }
+ if (mask & CWSibling)
+ {
+ /* TODO */
+ }
+ if (mask & CWStackMode)
+ {
+ /* TODO */
+ }
+ return 1;
+}
+
+int XTranslateCoordinates(Display* display, Window srcWindow, Window destWindow, int srcX, int srcY, int* destX, int* destY, Window* childReturn)
+{
+ int offx = 0;
+ int offy = 0;
+
+ Window w = srcWindow;
+ while (w != GR_ROOT_WINDOW_ID)
+ {
+ GR_WINDOW_INFO info;
+ GrGetWindowInfo(w, & info);
+ w = info.parent;
+
+ offx += info.x ;
+ offy += info.y ;
+ }
+
+ w = destWindow;
+
+ while (w != GR_ROOT_WINDOW_ID)
+ {
+ GR_WINDOW_INFO info;
+ GrGetWindowInfo(w, & info);
+ w = info.parent;
+
+ offx -= info.x ;
+ offy -= info.y ;
+ }
+
+ *destX = srcX + offx;
+ *destY = srcY + offy;
+
+ if (childReturn)
+ *childReturn = 0;
+
+ return 1;
+}
+
#endif
/* wxUSE_NANOX */
Region r = (Region) region.GetX11Region();
if (r)
{
+#if wxUSE_NANOX
+ GR_RECT rect;
+ GrGetRegionBox(r, & rect);
+ m_numRects = 1;
+ m_rects = new wxRect[1];
+ m_rects[0].x = rect.x;
+ m_rects[0].y = rect.y;
+ m_rects[0].width = rect.width;
+ m_rects[0].height = rect.height;
+#else
m_numRects = r->numRects;
if (m_numRects)
{
wr.height = xr.y2-xr.y1;
}
}
+#endif
}
}
m_backgroundColour.CalcPixel( (WXColormap) cm );
m_hasBgCol = TRUE;
+#if !wxUSE_NANOX
XSetWindowAttributes xattributes;
XSizeHints size_hints;
- XWMHints wm_hints;
long xattributes_mask =
CWOverrideRedirect |
CWBorderPixel | CWBackPixel;
+
xattributes.background_pixel = m_backgroundColour.GetPixel();
xattributes.border_pixel = BlackPixel( xdisplay, xscreen );
// I think we set this to True to remove decorations
// No. RR.
xattributes.override_redirect = False;
+#endif
wxSize size2(size);
if (size2.x == -1)
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());
+ foreColor = GR_RGB(m_foregroundColour.Red(), m_foregroundColour.Green(), m_foregroundColour.Blue());
+
+ Window xwindow = XCreateWindowWithColor( xdisplay, xparent, pos2.x, pos2.y, size2.x, size2.y,
+ 0, 0, InputOutput, xvisual, backColor, foreColor);
+#else
Window xwindow = XCreateWindow( xdisplay, xparent, pos2.x, pos2.y, size2.x, size2.y,
- 0, DefaultDepth(xdisplay,xscreen), InputOutput, xvisual, xattributes_mask, &xattributes );
+ 0, DefaultDepth(xdisplay,xscreen), InputOutput, xvisual, xattributes_mask, &xattributes );
+#endif
m_mainWidget = (WXWindow) xwindow;
- XSelectInput( xdisplay, xwindow,
+ int extraFlags = 0;
#if wxUSE_NANOX
- GR_EVENT_MASK_CLOSE_REQ |
+ extraFlags |= GR_EVENT_MASK_CLOSE_REQ;
#endif
- ExposureMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask |
+
+ XSelectInput( xdisplay, xwindow,
+ extraFlags | ExposureMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask |
ButtonMotionMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask |
KeymapStateMask | FocusChangeMask | ColormapChangeMask | StructureNotifyMask |
PropertyChangeMask );
// background completely.
XSetWindowBackgroundPixmap( xdisplay, xwindow, None );
+#if !wxUSE_NANOX
if (GetExtraStyle() & wxTOPLEVEL_EX_DIALOG)
{
if (GetParent() && GetParent()->GetMainWindow())
size_hints.height = size2.y;
XSetWMNormalHints( xdisplay, xwindow, &size_hints);
+ XWMHints wm_hints;
wm_hints.flags = InputHint | StateHint /* | WindowGroupHint */;
wm_hints.input = True;
wm_hints.initial_state = NormalState;
XSetWMHints( xdisplay, xwindow, &wm_hints);
-
+
Atom wm_protocols[2];
wm_protocols[0] = XInternAtom( xdisplay, "WM_DELETE_WINDOW", False );
wm_protocols[1] = XInternAtom( xdisplay, "WM_TAKE_FOCUS", False );
XSetWMProtocols( xdisplay, xwindow, wm_protocols, 2);
+#endif
wxSetWMDecorations( xwindow, style);
if (icon.Ok() && GetMainWindow())
{
+#if wxUSE_NANOX
+#else
XWMHints *wmHints = XAllocWMHints();
wmHints->icon_pixmap = (Pixmap) icon.GetPixmap();
XSetWMHints(wxGlobalDisplay(), (Window) GetMainWindow(), wmHints);
XFree(wmHints);
+#endif
}
}
// given wxWindows style
bool wxSetWMDecorations(Window w, long style)
{
+#if wxUSE_NANOX
+ GR_WM_PROPERTIES wmProp;
+
+ wmProp.flags = 0;
+
+ if (style & wxRESIZE_BORDER)
+ {
+ wmProp.props |= GR_WM_PROPS_APPFRAME ;
+ wmProp.flags |= GR_WM_FLAGS_PROPS ;
+ }
+
+ if (style & wxSYSTEM_MENU)
+ {
+ wmProp.props |= GR_WM_PROPS_CLOSEBOX ;
+ wmProp.flags |= GR_WM_FLAGS_PROPS ;
+ }
+
+ if ((style & wxCAPTION) ||
+ (style & wxTINY_CAPTION_HORIZ) ||
+ (style & wxTINY_CAPTION_VERT))
+ {
+ wmProp.props |= GR_WM_PROPS_CAPTION ;
+ wmProp.flags |= GR_WM_FLAGS_PROPS ;
+ }
+
+ if (style & wxTHICK_FRAME)
+ {
+ wmProp.props |= GR_WM_PROPS_APPFRAME ;
+ wmProp.flags |= GR_WM_FLAGS_PROPS ;
+ }
+
+ if (style & wxSIMPLE_BORDER)
+ {
+ wmProp.props |= GR_WM_PROPS_BORDER ;
+ wmProp.flags |= GR_WM_FLAGS_PROPS ;
+ }
+
+ if (style & wxMINIMIZE_BOX)
+ {
+ }
+
+ if (style & wxMAXIMIZE_BOX)
+ {
+ wmProp.props |= GR_WM_PROPS_MAXIMIZE ;
+ wmProp.flags |= GR_WM_FLAGS_PROPS ;
+ }
+
+ if (((style & wxBORDER) != wxBORDER) && ((style & wxTHICK_FRAME) != wxTHICK_FRAME)
+ && ((style & wxRESIZE_BORDER) != wxRESIZE_BORDER))
+ {
+ wmProp.props |= GR_WM_PROPS_NODECORATE ;
+ wmProp.flags |= GR_WM_FLAGS_PROPS ;
+ }
+
+ GrSetWMProperties(w, & wmProp);
+
+#else
if (!wxMWMIsRunning(w))
return FALSE;
32, PropModeReplace,
(unsigned char *) &hints, PROP_MOTIF_WM_HINTS_ELEMENTS);
+#endif
return TRUE;
}
bool wxMWMIsRunning(Window w)
{
+#if wxUSE_NANOX
+ return FALSE;
+#else
Display *dpy = (Display*)wxGetDisplay();
Atom motifWmInfo = XInternAtom(dpy, "_MOTIF_WM_INFO", False);
&type, &format, &length, &bytesafter, &ptr);
return (ret == Success);
+#endif
}
// For implementation purposes - sometimes decorations make the client area
int offsetX = 0;
int offsetY = 0;
+#if !wxUSE_NANOX
wxLogDebug("Translating...");
Window childWindow;
XTranslateCoordinates(wxGlobalDisplay(), window, XDefaultRootWindow(wxGlobalDisplay()),
wxString msg;
msg.Printf("Offset: %d, %d", offsetX, offsetY);
wxLogDebug(msg);
+#endif
XWindowAttributes attr;
Status status = XGetWindowAttributes(wxGlobalDisplay(), window, & attr);
void wxGetMousePosition( int* x, int* y )
{
+#if wxUSE_NANOX
+ // TODO
+ *x = 0;
+ *y = 0;
+#else
XMotionEvent xev;
Window root, child;
XQueryPointer((Display*) wxGetDisplay(),
&(xev.state));
*x = xev.x_root;
*y = xev.y_root;
+#endif
};
// Return TRUE if we have a colour display
return FALSE;
#endif
#ifdef __WXX11__
- Display* display = XOpenDisplay((const char*) display_name);
+ Display* display = XOpenDisplay((char*) display_name.c_str());
if (display)
{
void wxAllocNearestColor(Display *d,Colormap cmp,XColor *xc)
{
+#if !wxUSE_NANOX
int llp;
int screen = DefaultScreen(d);
*/
delete[] color_defs;
+#endif
}
void wxAllocColor(Display *d,Colormap cmp,XColor *xc)
#ifdef __WXDEBUG__
wxString wxGetXEventName(XEvent& event)
{
+#if wxUSE_NANOX
+ wxString str(wxT("(some event)"));
+ return str;
+#else
int type = event.xany.type;
static char* event_name[] = {
"", "unknown(-)", // 0-1
type = wxMin(35, type); type = wxMax(1, type);
wxString str(event_name[type]);
return str;
- }
+#endif
+}
#endif
#ifdef __WXMOTIF__
#include "wx/x11/private.h"
#include "X11/Xutil.h"
+#if wxUSE_NANOX
+// For wxGetLocalTime, used by XButtonEventGetTime
+#include "wx/timer.h"
+#endif
+
#include <string.h>
// ----------------------------------------------------------------------------
Window xparent = (Window) parent->GetMainWindow();
+#if !wxUSE_NANOX
XSetWindowAttributes xattributes;
long xattributes_mask =
ButtonMotionMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask |
KeymapStateMask | FocusChangeMask | ColormapChangeMask | StructureNotifyMask |
PropertyChangeMask;
+#endif
wxSize size2(size);
if (size2.x == -1)
if (pos2.y == -1)
pos2.y = 0;
+#if wxUSE_NANOX
+ int extraFlags = GR_EVENT_MASK_CLOSE_REQ;
+
+ long backColor, foreColor;
+ backColor = GR_RGB(m_backgroundColour.Red(), m_backgroundColour.Green(), m_backgroundColour.Blue());
+ foreColor = GR_RGB(m_foregroundColour.Red(), m_foregroundColour.Green(), m_foregroundColour.Blue());
+
+ Window xwindow = XCreateWindowWithColor( xdisplay, xparent, pos2.x, pos2.y, size2.x, size2.y,
+ 0, 0, InputOutput, xvisual, backColor, foreColor);
+ XSelectInput( xdisplay, xwindow,
+ extraFlags | ExposureMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask |
+ ButtonMotionMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask |
+ KeymapStateMask | FocusChangeMask | ColormapChangeMask | StructureNotifyMask |
+ PropertyChangeMask );
+
+#else
+
Window xwindow = XCreateWindow( xdisplay, xparent, pos2.x, pos2.y, size2.x, size2.y,
0, DefaultDepth(xdisplay,xscreen), InputOutput, xvisual, xattributes_mask, &xattributes );
-
+
+#endif
+
m_mainWidget = (WXWindow) xwindow;
wxAddWindowToTable( xwindow, (wxWindow*) this );
m_maxWidth = maxW;
m_maxHeight = maxH;
+#if !wxUSE_NANOX
XSizeHints sizeHints;
sizeHints.flags = 0;
}
XSetWMNormalHints(wxGlobalDisplay(), (Window) GetMainWindow(), & sizeHints);
+#endif
}
void wxWindowX11::DoMoveWindow(int x, int y, int width, int height)
&ascent, &descent2, &overall);
#endif
- XTextExtents((XFontStruct*) pFontStruct, string.c_str(), slen,
+ XTextExtents((XFontStruct*) pFontStruct, (char*) string.c_str(), slen,
&direction, &ascent, &descent2, &overall);
if ( x )
bool wxTranslateMouseEvent(wxMouseEvent& wxevent, wxWindow *win, Window window, XEvent *xevent)
{
- switch (xevent->xany.type)
+ switch (XEventGetType(xevent))
{
case EnterNotify:
case LeaveNotify:
{
wxEventType eventType = wxEVT_NULL;
- if (xevent->xany.type == EnterNotify)
+ if (XEventGetType(xevent) == EnterNotify)
{
//if (local_event.xcrossing.mode!=NotifyNormal)
// return ; // Ignore grab events
eventType = wxEVT_ENTER_WINDOW;
// canvas->GetEventHandler()->OnSetFocus();
}
- else if (xevent->xany.type == LeaveNotify)
+ else if (XEventGetType(xevent) == LeaveNotify)
{
//if (local_event.xcrossingr.mode!=NotifyNormal)
// return ; // Ignore grab events
eventType = wxEVT_LEAVE_WINDOW;
// canvas->GetEventHandler()->OnKillFocus();
}
- else if (xevent->xany.type == MotionNotify)
+ else if (XEventGetType(xevent) == MotionNotify)
{
eventType = wxEVT_MOTION;
}
- else if (xevent->xany.type == ButtonPress)
+ else if (XEventGetType(xevent) == ButtonPress)
{
- wxevent.SetTimestamp(xevent->xbutton.time);
+ wxevent.SetTimestamp(XButtonEventGetTime(xevent));
int button = 0;
- if (xevent->xbutton.button == Button1)
+ if (XButtonEventLChanged(xevent))
{
eventType = wxEVT_LEFT_DOWN;
button = 1;
}
- else if (xevent->xbutton.button == Button2)
+ else if (XButtonEventMChanged(xevent))
{
eventType = wxEVT_MIDDLE_DOWN;
button = 2;
}
- else if (xevent->xbutton.button == Button3)
+ else if (XButtonEventRChanged(xevent))
{
eventType = wxEVT_RIGHT_DOWN;
button = 3;
win->SetLastClick(button, ts);
}
}
- else if (xevent->xany.type == ButtonRelease)
+ else if (XEventGetType(xevent) == ButtonRelease)
{
- if (xevent->xbutton.button == Button1)
+ if (XButtonEventLChanged(xevent))
{
eventType = wxEVT_LEFT_UP;
}
- else if (xevent->xbutton.button == Button2)
+ else if (XButtonEventMChanged(xevent))
{
eventType = wxEVT_MIDDLE_UP;
}
- else if (xevent->xbutton.button == Button3)
+ else if (XButtonEventRChanged(xevent))
{
eventType = wxEVT_RIGHT_UP;
}
wxevent.SetEventType(eventType);
- wxevent.m_x = xevent->xbutton.x;
- wxevent.m_y = xevent->xbutton.y;
+ wxevent.m_x = XButtonEventGetX(xevent);
+ wxevent.m_y = XButtonEventGetY(xevent);
wxevent.m_leftDown = ((eventType == wxEVT_LEFT_DOWN)
- || (event_left_is_down (xevent)
+ || (XButtonEventLIsDown(xevent)
&& (eventType != wxEVT_LEFT_UP)));
wxevent.m_middleDown = ((eventType == wxEVT_MIDDLE_DOWN)
- || (event_middle_is_down (xevent)
+ || (XButtonEventMIsDown(xevent)
&& (eventType != wxEVT_MIDDLE_UP)));
wxevent.m_rightDown = ((eventType == wxEVT_RIGHT_DOWN)
- || (event_right_is_down (xevent)
+ || (XButtonEventRIsDown (xevent)
&& (eventType != wxEVT_RIGHT_UP)));
- wxevent.m_shiftDown = xevent->xbutton.state & ShiftMask;
- wxevent.m_controlDown = xevent->xbutton.state & ControlMask;
- wxevent.m_altDown = xevent->xbutton.state & Mod3Mask;
- wxevent.m_metaDown = xevent->xbutton.state & Mod1Mask;
+ wxevent.m_shiftDown = XButtonEventShiftIsDown(xevent);
+ wxevent.m_controlDown = XButtonEventCtrlIsDown(xevent);
+ wxevent.m_altDown = XButtonEventAltIsDown(xevent);
+ wxevent.m_metaDown = XButtonEventMetaIsDown(xevent);
wxevent.SetId(win->GetId());
wxevent.SetEventObject(win);
bool wxTranslateKeyEvent(wxKeyEvent& wxevent, wxWindow *win, Window WXUNUSED(win), XEvent *xevent)
{
- switch (xevent->xany.type)
+ switch (XEventGetType(xevent))
{
case KeyPress:
case KeyRelease:
(void) XLookupString ((XKeyEvent *) xevent, buf, 20, &keySym, NULL);
int id = wxCharCodeXToWX (keySym);
- if (xevent->xkey.state & ShiftMask)
- wxevent.m_shiftDown = TRUE;
- if (xevent->xkey.state & ControlMask)
- wxevent.m_controlDown = TRUE;
- if (xevent->xkey.state & Mod3Mask)
- wxevent.m_altDown = TRUE;
- if (xevent->xkey.state & Mod1Mask)
- wxevent.m_metaDown = TRUE;
+ wxevent.m_shiftDown = XKeyEventShiftIsDown(xevent);
+ wxevent.m_controlDown = XKeyEventCtrlIsDown(xevent);
+ wxevent.m_altDown = XKeyEventAltIsDown(xevent);
+ wxevent.m_metaDown = XKeyEventMetaIsDown(xevent);
wxevent.SetEventObject(win);
wxevent.m_keyCode = id;
- wxevent.SetTimestamp(xevent->xkey.time);
+ wxevent.SetTimestamp(XKeyEventGetTime(xevent));
- wxevent.m_x = xevent->xbutton.x;
- wxevent.m_y = xevent->xbutton.y;
+ wxevent.m_x = XKeyEventGetX(xevent);
+ wxevent.m_y = XKeyEventGetY(xevent);
if (id > -1)
return TRUE;
// Get the current mouse position.
wxPoint wxGetMousePosition()
{
+#if wxUSE_NANOX
+ /* TODO */
+ return wxPoint(0, 0);
+#else
Display *display = wxGlobalDisplay();
Window rootWindow = RootWindowOfScreen (DefaultScreenOfDisplay(display));
Window rootReturn, childReturn;
&childReturn,
&rootX, &rootY, &winX, &winY, &maskReturn);
return wxPoint(rootX, rootY);
+#endif
}