wxUSE_CONSTRAINTS now refers to constraints only, since sizers
are now crucial to wxWindows. Further Nano-X fixes; now compiles and links in Nano-X mode. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14358 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
adc350786e
commit
461e93f921
2
configure
vendored
2
configure
vendored
@ -12248,7 +12248,7 @@ rm -f conftest*
|
||||
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
|
||||
|
@ -1905,7 +1905,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"
|
||||
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
|
||||
|
@ -8,15 +8,21 @@ Widgets are supplied by the wxUniversal project, while the
|
||||
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.
|
||||
|
@ -702,15 +702,6 @@ public:
|
||||
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
|
||||
@ -733,6 +724,17 @@ public:
|
||||
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; }
|
||||
@ -741,8 +743,6 @@ public:
|
||||
void SetContainingSizer(wxSizer* sizer) { m_containingSizer = sizer; }
|
||||
wxSizer *GetContainingSizer() const { return m_containingSizer; }
|
||||
|
||||
#endif // wxUSE_CONSTRAINTS
|
||||
|
||||
// backward compatibility
|
||||
// ----------------------
|
||||
#if WXWIN_COMPATIBILITY
|
||||
@ -843,6 +843,7 @@ protected:
|
||||
|
||||
// constraints this window is involved in
|
||||
wxWindowList *m_constraintsInvolvedIn;
|
||||
#endif // wxUSE_CONSTRAINTS
|
||||
|
||||
// this window's sizer
|
||||
wxSizer *m_windowSizer;
|
||||
@ -852,7 +853,6 @@ protected:
|
||||
|
||||
// Layout() window automatically when its size changes?
|
||||
bool m_autoLayout:1;
|
||||
#endif // wxUSE_CONSTRAINTS
|
||||
|
||||
// window state
|
||||
bool m_isShown:1;
|
||||
|
@ -5,6 +5,10 @@
|
||||
#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>
|
||||
@ -19,7 +23,8 @@ typedef int Status;
|
||||
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;
|
||||
@ -33,6 +38,24 @@ typedef struct {
|
||||
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; */
|
||||
|
||||
@ -64,6 +87,10 @@ typedef struct {
|
||||
#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
|
||||
@ -88,12 +115,14 @@ inline void wxNoop() { /* Do nothing */ }
|
||||
|
||||
#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()
|
||||
@ -118,7 +147,14 @@ inline void wxNoop() { /* Do nothing */ }
|
||||
#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.
|
||||
@ -258,10 +294,11 @@ typedef int (*XErrorHandler) ( /* WARNING, this type not in Xlib spec */
|
||||
|
||||
/* 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 */,
|
||||
@ -275,7 +312,7 @@ int XGrabPointer(Display* /* display */, Window /* grab_window */,
|
||||
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) ;
|
||||
@ -284,7 +321,6 @@ int XCopyPlane(Display* /* display */, Drawable src, Drawable dest, GC gc,
|
||||
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 */);
|
||||
@ -302,8 +338,13 @@ int XPending(Display *d);
|
||||
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);
|
||||
|
||||
#ifdef __cpluplus
|
||||
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 __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -67,21 +67,65 @@ bool wxWindowIsVisible(Window win);
|
||||
|
||||
#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
|
||||
|
||||
|
@ -483,8 +483,6 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h )
|
||||
: 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"));
|
||||
@ -779,6 +777,8 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h )
|
||||
m_notebook->AddPage(panel, "wxBitmapXXX");
|
||||
|
||||
// layout constraints
|
||||
#if wxUSE_CONSTRAINTS
|
||||
wxLayoutConstraints *c;
|
||||
|
||||
panel = new wxPanel(m_notebook);
|
||||
panel->SetAutoLayout( TRUE );
|
||||
@ -802,7 +802,8 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h )
|
||||
pMyButton2->SetConstraints( c );
|
||||
|
||||
m_notebook->AddPage(panel, "wxLayoutConstraint");
|
||||
|
||||
#endif
|
||||
|
||||
// sizer
|
||||
|
||||
panel = new wxPanel(m_notebook);
|
||||
|
@ -47,9 +47,10 @@
|
||||
|
||||
#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
|
||||
@ -151,10 +152,11 @@ void wxWindowBase::InitBase()
|
||||
// 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;
|
||||
@ -258,14 +260,14 @@ wxWindowBase::~wxWindowBase()
|
||||
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;
|
||||
@ -1181,6 +1183,7 @@ void wxWindowBase::DeleteRelatedConstraints()
|
||||
m_constraintsInvolvedIn = (wxWindowList *) NULL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void wxWindowBase::SetSizer(wxSizer *sizer)
|
||||
{
|
||||
@ -1199,6 +1202,7 @@ bool wxWindowBase::Layout()
|
||||
|
||||
GetSizer()->SetDimension( 0, 0, w, h );
|
||||
}
|
||||
#if wxUSE_CONSTRAINTS
|
||||
else
|
||||
{
|
||||
wxLayoutConstraints *constr = GetConstraints();
|
||||
@ -1222,11 +1226,12 @@ bool wxWindowBase::Layout()
|
||||
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.
|
||||
@ -1432,6 +1437,20 @@ void wxWindowBase::GetClientSizeConstraint(int *w, int *h) const
|
||||
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
|
||||
@ -1448,21 +1467,6 @@ void wxWindowBase::AdjustForParentClientOrigin(int& x, int& y, int sizeFlags)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@ -20,6 +20,8 @@
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#if wxUSE_PROLOGIO
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
@ -1272,3 +1274,5 @@ WXDLLEXPORT char *strdup(const char *s)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
// wxUSE_PROLOGIO
|
||||
|
@ -67,6 +67,7 @@ static bool ProcessFamiliesFromFontList(wxFontEnumerator *This,
|
||||
// helpers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#if !wxUSE_NANOX
|
||||
static char **CreateFontList(wxChar spacing,
|
||||
wxFontEncoding encoding,
|
||||
int *nFonts)
|
||||
@ -136,6 +137,8 @@ static bool ProcessFamiliesFromFontList(wxFontEnumerator *This,
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
// wxUSE_NANOX
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxFontEnumerator
|
||||
@ -144,6 +147,9 @@ static bool ProcessFamiliesFromFontList(wxFontEnumerator *This,
|
||||
bool wxFontEnumerator::EnumerateFacenames(wxFontEncoding encoding,
|
||||
bool fixedWidthOnly)
|
||||
{
|
||||
#if wxUSE_NANOX
|
||||
return FALSE;
|
||||
#else
|
||||
int nFonts;
|
||||
char **fonts;
|
||||
|
||||
@ -187,12 +193,16 @@ bool wxFontEnumerator::EnumerateFacenames(wxFontEncoding encoding,
|
||||
(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());
|
||||
@ -257,4 +267,6 @@ bool wxFontEnumerator::EnumerateEncodings(const wxString& family)
|
||||
XFreeFontNames(fonts);
|
||||
|
||||
return TRUE;
|
||||
#endif
|
||||
// wxUSE_NANOX
|
||||
}
|
||||
|
@ -237,7 +237,7 @@ int wxEntryStart( int& argc, char *argv[] )
|
||||
if (displayName.IsEmpty())
|
||||
xdisplay = XOpenDisplay(NULL);
|
||||
else
|
||||
xdisplay = XOpenDisplay(displayName.c_str());
|
||||
xdisplay = XOpenDisplay((char*) displayName.c_str());
|
||||
|
||||
if (!xdisplay)
|
||||
{
|
||||
|
117
src/x11/nanox.c
117
src/x11/nanox.c
@ -8,8 +8,13 @@
|
||||
|
||||
#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"
|
||||
|
||||
@ -71,7 +76,7 @@ int XGrabPointer(Display* display, Window grab_window,
|
||||
return Success;
|
||||
}
|
||||
|
||||
int XUngrabPointer(Display display, Time time)
|
||||
int XUngrabPointer(Display* display, Time time)
|
||||
{
|
||||
return Success;
|
||||
}
|
||||
@ -235,10 +240,60 @@ int XAllocColor(Display* display, Colormap cmap,
|
||||
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;
|
||||
}
|
||||
|
||||
@ -320,5 +375,63 @@ int XQueryColor(Display* display, Colormap cmap, XColor* color)
|
||||
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 */
|
||||
|
@ -450,6 +450,16 @@ void wxRIRefData::CreateRects( const wxRegion& region )
|
||||
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)
|
||||
{
|
||||
@ -464,6 +474,7 @@ void wxRIRefData::CreateRects( const wxRegion& region )
|
||||
wr.height = xr.y2-xr.y1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -101,13 +101,14 @@ bool wxTopLevelWindowX11::Create(wxWindow *parent,
|
||||
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 );
|
||||
|
||||
@ -115,6 +116,7 @@ bool wxTopLevelWindowX11::Create(wxWindow *parent,
|
||||
// I think we set this to True to remove decorations
|
||||
// No. RR.
|
||||
xattributes.override_redirect = False;
|
||||
#endif
|
||||
|
||||
wxSize size2(size);
|
||||
if (size2.x == -1)
|
||||
@ -128,15 +130,26 @@ bool wxTopLevelWindowX11::Create(wxWindow *parent,
|
||||
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 );
|
||||
@ -147,6 +160,7 @@ bool wxTopLevelWindowX11::Create(wxWindow *parent,
|
||||
// background completely.
|
||||
XSetWindowBackgroundPixmap( xdisplay, xwindow, None );
|
||||
|
||||
#if !wxUSE_NANOX
|
||||
if (GetExtraStyle() & wxTOPLEVEL_EX_DIALOG)
|
||||
{
|
||||
if (GetParent() && GetParent()->GetMainWindow())
|
||||
@ -163,15 +177,17 @@ bool wxTopLevelWindowX11::Create(wxWindow *parent,
|
||||
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);
|
||||
|
||||
@ -287,6 +303,8 @@ void wxTopLevelWindowX11::SetIcon(const wxIcon& icon)
|
||||
|
||||
if (icon.Ok() && GetMainWindow())
|
||||
{
|
||||
#if wxUSE_NANOX
|
||||
#else
|
||||
XWMHints *wmHints = XAllocWMHints();
|
||||
wmHints->icon_pixmap = (Pixmap) icon.GetPixmap();
|
||||
|
||||
@ -300,6 +318,7 @@ void wxTopLevelWindowX11::SetIcon(const wxIcon& icon)
|
||||
|
||||
XSetWMHints(wxGlobalDisplay(), (Window) GetMainWindow(), wmHints);
|
||||
XFree(wmHints);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -361,6 +380,63 @@ struct MwmHints {
|
||||
// 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;
|
||||
|
||||
@ -419,11 +495,15 @@ bool wxSetWMDecorations(Window w, long style)
|
||||
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);
|
||||
|
||||
@ -441,6 +521,7 @@ bool wxMWMIsRunning(Window w)
|
||||
&type, &format, &length, &bytesafter, &ptr);
|
||||
|
||||
return (ret == Success);
|
||||
#endif
|
||||
}
|
||||
|
||||
// For implementation purposes - sometimes decorations make the client area
|
||||
@ -568,6 +649,7 @@ void wxTopLevelWindowX11::DoGetPosition(int *x, int *y) const
|
||||
int offsetX = 0;
|
||||
int offsetY = 0;
|
||||
|
||||
#if !wxUSE_NANOX
|
||||
wxLogDebug("Translating...");
|
||||
Window childWindow;
|
||||
XTranslateCoordinates(wxGlobalDisplay(), window, XDefaultRootWindow(wxGlobalDisplay()),
|
||||
@ -576,6 +658,7 @@ void wxTopLevelWindowX11::DoGetPosition(int *x, int *y) const
|
||||
wxString msg;
|
||||
msg.Printf("Offset: %d, %d", offsetX, offsetY);
|
||||
wxLogDebug(msg);
|
||||
#endif
|
||||
|
||||
XWindowAttributes attr;
|
||||
Status status = XGetWindowAttributes(wxGlobalDisplay(), window, & attr);
|
||||
|
@ -568,6 +568,11 @@ wxSetDefaultResources (const Widget w, const char **resourceSpec, const char *na
|
||||
|
||||
void wxGetMousePosition( int* x, int* y )
|
||||
{
|
||||
#if wxUSE_NANOX
|
||||
// TODO
|
||||
*x = 0;
|
||||
*y = 0;
|
||||
#else
|
||||
XMotionEvent xev;
|
||||
Window root, child;
|
||||
XQueryPointer((Display*) wxGetDisplay(),
|
||||
@ -578,6 +583,7 @@ void wxGetMousePosition( int* x, int* y )
|
||||
&(xev.state));
|
||||
*x = xev.x_root;
|
||||
*y = xev.y_root;
|
||||
#endif
|
||||
};
|
||||
|
||||
// Return TRUE if we have a colour display
|
||||
@ -683,7 +689,7 @@ bool wxSetDisplay(const wxString& display_name)
|
||||
return FALSE;
|
||||
#endif
|
||||
#ifdef __WXX11__
|
||||
Display* display = XOpenDisplay((const char*) display_name);
|
||||
Display* display = XOpenDisplay((char*) display_name.c_str());
|
||||
|
||||
if (display)
|
||||
{
|
||||
@ -1015,6 +1021,7 @@ void wxXColorToHSV(wxHSV *hsv,XColor *rgb)
|
||||
|
||||
void wxAllocNearestColor(Display *d,Colormap cmp,XColor *xc)
|
||||
{
|
||||
#if !wxUSE_NANOX
|
||||
int llp;
|
||||
|
||||
int screen = DefaultScreen(d);
|
||||
@ -1051,6 +1058,7 @@ void wxAllocNearestColor(Display *d,Colormap cmp,XColor *xc)
|
||||
*/
|
||||
|
||||
delete[] color_defs;
|
||||
#endif
|
||||
}
|
||||
|
||||
void wxAllocColor(Display *d,Colormap cmp,XColor *xc)
|
||||
@ -1065,6 +1073,10 @@ 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
|
||||
@ -1082,7 +1094,8 @@ wxString wxGetXEventName(XEvent& event)
|
||||
type = wxMin(35, type); type = wxMax(1, type);
|
||||
wxString str(event_name[type]);
|
||||
return str;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __WXMOTIF__
|
||||
|
@ -47,6 +47,11 @@
|
||||
#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>
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -136,6 +141,7 @@ bool wxWindowX11::Create(wxWindow *parent, wxWindowID id,
|
||||
|
||||
Window xparent = (Window) parent->GetMainWindow();
|
||||
|
||||
#if !wxUSE_NANOX
|
||||
XSetWindowAttributes xattributes;
|
||||
|
||||
long xattributes_mask =
|
||||
@ -150,6 +156,7 @@ bool wxWindowX11::Create(wxWindow *parent, wxWindowID id,
|
||||
ButtonMotionMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask |
|
||||
KeymapStateMask | FocusChangeMask | ColormapChangeMask | StructureNotifyMask |
|
||||
PropertyChangeMask;
|
||||
#endif
|
||||
|
||||
wxSize size2(size);
|
||||
if (size2.x == -1)
|
||||
@ -163,9 +170,28 @@ bool wxWindowX11::Create(wxWindow *parent, wxWindowID id,
|
||||
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 );
|
||||
@ -786,6 +812,7 @@ void wxWindowX11::SetSizeHints(int minW, int minH, int maxW, int maxH, int incW,
|
||||
m_maxWidth = maxW;
|
||||
m_maxHeight = maxH;
|
||||
|
||||
#if !wxUSE_NANOX
|
||||
XSizeHints sizeHints;
|
||||
sizeHints.flags = 0;
|
||||
|
||||
@ -809,6 +836,7 @@ void wxWindowX11::SetSizeHints(int minW, int minH, int maxW, int maxH, int incW,
|
||||
}
|
||||
|
||||
XSetWMNormalHints(wxGlobalDisplay(), (Window) GetMainWindow(), & sizeHints);
|
||||
#endif
|
||||
}
|
||||
|
||||
void wxWindowX11::DoMoveWindow(int x, int y, int width, int height)
|
||||
@ -883,7 +911,7 @@ void wxWindowX11::GetTextExtent(const wxString& string,
|
||||
&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 )
|
||||
@ -1109,7 +1137,7 @@ WXWindow wxWindowX11::GetMainWindow() const
|
||||
|
||||
bool wxTranslateMouseEvent(wxMouseEvent& wxevent, wxWindow *win, Window window, XEvent *xevent)
|
||||
{
|
||||
switch (xevent->xany.type)
|
||||
switch (XEventGetType(xevent))
|
||||
{
|
||||
case EnterNotify:
|
||||
case LeaveNotify:
|
||||
@ -1119,39 +1147,39 @@ bool wxTranslateMouseEvent(wxMouseEvent& wxevent, wxWindow *win, Window window,
|
||||
{
|
||||
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;
|
||||
@ -1182,17 +1210,17 @@ bool wxTranslateMouseEvent(wxMouseEvent& wxevent, wxWindow *win, Window window,
|
||||
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;
|
||||
}
|
||||
@ -1205,23 +1233,23 @@ bool wxTranslateMouseEvent(wxMouseEvent& wxevent, wxWindow *win, Window window,
|
||||
|
||||
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);
|
||||
@ -1234,7 +1262,7 @@ bool wxTranslateMouseEvent(wxMouseEvent& wxevent, wxWindow *win, Window window,
|
||||
|
||||
bool wxTranslateKeyEvent(wxKeyEvent& wxevent, wxWindow *win, Window WXUNUSED(win), XEvent *xevent)
|
||||
{
|
||||
switch (xevent->xany.type)
|
||||
switch (XEventGetType(xevent))
|
||||
{
|
||||
case KeyPress:
|
||||
case KeyRelease:
|
||||
@ -1245,20 +1273,16 @@ bool wxTranslateKeyEvent(wxKeyEvent& wxevent, wxWindow *win, Window WXUNUSED(win
|
||||
(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;
|
||||
@ -1338,6 +1362,10 @@ wxWindow* wxFindWindowAtPointer(wxPoint& pt)
|
||||
// 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;
|
||||
@ -1350,6 +1378,7 @@ wxPoint wxGetMousePosition()
|
||||
&childReturn,
|
||||
&rootX, &rootY, &winX, &winY, &maskReturn);
|
||||
return wxPoint(rootX, rootY);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user