Added some Xlib replacement functions and structures for Nano-X
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14280 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -7,6 +7,41 @@
|
|||||||
/* Data types */
|
/* Data types */
|
||||||
|
|
||||||
typedef GR_PALETTE Colormap;
|
typedef GR_PALETTE Colormap;
|
||||||
|
typedef GR_DRAW_ID Drawable ;
|
||||||
|
typedef int Status;
|
||||||
|
|
||||||
|
#define Success 0
|
||||||
|
#define GrabSuccess Success
|
||||||
|
#define GrabNotViewable (Success+1)
|
||||||
|
#define InputOutput 1
|
||||||
|
#define InputOnly 2
|
||||||
|
#define IsUnmapped 0
|
||||||
|
#define IsUnviewable 1
|
||||||
|
#define IsViewable 2
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int x, y; /* location of window */
|
||||||
|
int width, height; /* width and height of window */
|
||||||
|
int border_width; /* border width of window */
|
||||||
|
int depth; /* depth of window */
|
||||||
|
Visual *visual; /* the associated visual structure */
|
||||||
|
Window root; /* root of screen containing window */
|
||||||
|
int class; /* InputOutput, InputOnly*/
|
||||||
|
int bit_gravity; /* one of the bit gravity values */
|
||||||
|
int win_gravity; /* one of the window gravity values */
|
||||||
|
int backing_store; /* NotUseful, WhenMapped, Always */
|
||||||
|
unsigned long backing_planes;/* planes to be preserved if possible */
|
||||||
|
unsigned long backing_pixel;/* value to be used when restoring planes */
|
||||||
|
Bool save_under; /* boolean, should bits under be saved? */
|
||||||
|
Colormap colormap; /* color map to be associated with window */
|
||||||
|
Bool map_installed; /* boolean, is color map currently installed*/
|
||||||
|
int map_state; /* IsUnmapped, IsUnviewable, IsViewable */
|
||||||
|
long all_event_masks; /* set of events all people have interest in*/
|
||||||
|
long your_event_mask; /* my event mask */
|
||||||
|
long do_not_propagate_mask;/* set of events that should not propagate */
|
||||||
|
Bool override_redirect; /* boolean value for override-redirect */
|
||||||
|
Screen *screen; /* back pointer to correct screen */
|
||||||
|
} XWindowAttributes;
|
||||||
|
|
||||||
/* events*/
|
/* events*/
|
||||||
|
|
||||||
@@ -34,7 +69,26 @@ typedef GR_PALETTE Colormap;
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Colormap DefaultColormapOfScreen(Screen /* screen */);
|
Colormap DefaultColormapOfScreen(Screen /* screen */) ;
|
||||||
|
int XSetGraphicsExposures( Display* /* display */, GC /* gc */, Bool /* graphics_exposures */) ;
|
||||||
|
int XWarpPointer( Display* /* display */, Window /* srcW */, Window /* srcW */,
|
||||||
|
int /* srcX */, int /* srcY */,
|
||||||
|
unsigned int /* srcWidth */,
|
||||||
|
unsigned int /* srcHeight */,
|
||||||
|
int destX, int destY);
|
||||||
|
int XSetInputFocus(Display* /* display */, Window focus, int /* revert_to */, Time /* time */) ;
|
||||||
|
int XGetInputFocus(Display* /* display */, Window* /* focus_return */, int* /* revert_to_return */) ;
|
||||||
|
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 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 XCopyPlane(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, unsigned long /* plane */) ;
|
||||||
|
|
||||||
#ifdef __cpluplus
|
#ifdef __cpluplus
|
||||||
}
|
}
|
||||||
|
146
src/x11/nanox.c
146
src/x11/nanox.c
@@ -24,5 +24,151 @@ Colormap DefaultColormapOfScreen(Screen /* screen */)
|
|||||||
return s_globalColormap;
|
return s_globalColormap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int XSetGraphicsExposures( Display* /* display */, GC /* gc */, Bool /* graphics_exposures */)
|
||||||
|
{
|
||||||
|
return Success ;
|
||||||
|
}
|
||||||
|
|
||||||
|
int XWarpPointer( Display* /* display */, Window /* srcW */, Window /* srcW */,
|
||||||
|
int /* srcX */, int /* srcY */,
|
||||||
|
unsigned int /* srcWidth */,
|
||||||
|
unsigned int /* srcHeight */,
|
||||||
|
int destX, int destY)
|
||||||
|
{
|
||||||
|
GrMoveCursor(destX, destY);
|
||||||
|
return Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
int XSetInputFocus(Display* /* display */, Window focus, int /* revert_to */, Time /* time */)
|
||||||
|
{
|
||||||
|
GrSetFocus(focus);
|
||||||
|
return Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
int XGetInputFocus(Display* /* display */, Window* /* focus_return */, int* /* revert_to_return */)
|
||||||
|
{
|
||||||
|
* focus_return = GrGetFocus();
|
||||||
|
* revert_to_return = 0;
|
||||||
|
return Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
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 */)
|
||||||
|
{
|
||||||
|
/* According to comments in srvevent.c in Nano-X, the pointer
|
||||||
|
* is implicitly grabbed when a mouse button is down.
|
||||||
|
* We may be able to simulate this further in the event loop.
|
||||||
|
*/
|
||||||
|
return Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
int XUngrabPointer(Display /* display */, Time /* time */)
|
||||||
|
{
|
||||||
|
return Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
GrCopyArea(dest, gc, dest_x, dest_y,
|
||||||
|
width, height, src,
|
||||||
|
src_x, src_y, 0);
|
||||||
|
return Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
int XCopyPlane(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, unsigned long /* plane */)
|
||||||
|
{
|
||||||
|
GrCopyArea(dest, gc, dest_x, dest_y,
|
||||||
|
width, height, src,
|
||||||
|
src_x, src_y, 0);
|
||||||
|
return Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
typedef struct {
|
||||||
|
GR_WINDOW_ID wid; /* window id (or 0 if no such window) */
|
||||||
|
GR_WINDOW_ID parent; /* parent window id */
|
||||||
|
GR_WINDOW_ID child; /* first child window id (or 0) */
|
||||||
|
GR_WINDOW_ID sibling; /* next sibling window id (or 0) */
|
||||||
|
GR_BOOL inputonly; /* TRUE if window is input only */
|
||||||
|
GR_BOOL mapped; /* TRUE if window is mapped */
|
||||||
|
GR_COUNT unmapcount; /* reasons why window is unmapped */
|
||||||
|
GR_COORD x; /* absolute x position of window */
|
||||||
|
GR_COORD y; /* absolute y position of window */
|
||||||
|
GR_SIZE width; /* width of window */
|
||||||
|
GR_SIZE height; /* height of window */
|
||||||
|
GR_SIZE bordersize; /* size of border */
|
||||||
|
GR_COLOR bordercolor; /* color of border */
|
||||||
|
GR_COLOR background; /* background color */
|
||||||
|
GR_EVENT_MASK eventmask; /* current event mask for this client */
|
||||||
|
GR_WM_PROPS props; /* window properties */
|
||||||
|
GR_CURSOR_ID cursor; /* cursor id*/
|
||||||
|
unsigned long processid; /* process id of owner*/
|
||||||
|
} GR_WINDOW_INFO;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int x, y; /* location of window */
|
||||||
|
int width, height; /* width and height of window */
|
||||||
|
int border_width; /* border width of window */
|
||||||
|
int depth; /* depth of window */
|
||||||
|
Visual *visual; /* the associated visual structure */
|
||||||
|
Window root; /* root of screen containing window */
|
||||||
|
int class; /* InputOutput, InputOnly*/
|
||||||
|
int bit_gravity; /* one of the bit gravity values */
|
||||||
|
int win_gravity; /* one of the window gravity values */
|
||||||
|
int backing_store; /* NotUseful, WhenMapped, Always */
|
||||||
|
unsigned long backing_planes;/* planes to be preserved if possible */
|
||||||
|
unsigned long backing_pixel;/* value to be used when restoring planes */
|
||||||
|
Bool save_under; /* boolean, should bits under be saved? */
|
||||||
|
Colormap colormap; /* color map to be associated with window */
|
||||||
|
Bool map_installed; /* boolean, is color map currently installed*/
|
||||||
|
int map_state; /* IsUnmapped, IsUnviewable, IsViewable */
|
||||||
|
long all_event_masks; /* set of events all people have interest in*/
|
||||||
|
long your_event_mask; /* my event mask */
|
||||||
|
long do_not_propagate_mask;/* set of events that should not propagate */
|
||||||
|
Bool override_redirect; /* boolean value for override-redirect */
|
||||||
|
Screen *screen; /* back pointer to correct screen */
|
||||||
|
} XWindowAttributes;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
Status XGetWindowAttributes(Display* display, Window w,
|
||||||
|
XWindowAttributes* window_attributes_return)
|
||||||
|
{
|
||||||
|
GR_WINDOW_INFO info;
|
||||||
|
GrGetWindowInfo(w, & info);
|
||||||
|
|
||||||
|
window_attributes->x = info.x;
|
||||||
|
window_attributes->y = info.y;
|
||||||
|
window_attributes->width = info.width;
|
||||||
|
window_attributes->height = info.height;
|
||||||
|
window_attributes->border_width = info.bordersize;
|
||||||
|
window_attributes->depth = 0;
|
||||||
|
window_attributes->visual = NULL;
|
||||||
|
window_attributes->root = 0;
|
||||||
|
window_attributes->class = info.inputonly ? InputOnly : InputOutput ;
|
||||||
|
window_attributes->bit_gravity = 0;
|
||||||
|
window_attributes->win_gravity = 0;
|
||||||
|
window_attributes->backing_store = 0;
|
||||||
|
window_attributes->backing_planes = 0;
|
||||||
|
window_attributes->backing_pixel = 0;
|
||||||
|
window_attributes->save_under = FALSE;
|
||||||
|
window_attributes->colormap = DefaultColormapOfScreen(0);
|
||||||
|
window_attributes->map_installed = FALSE;
|
||||||
|
window_attributes->map_state = info.mapped ? IsViewable : IsUnmapped ;
|
||||||
|
window_attributes->all_event_masks = 0;
|
||||||
|
window_attributes->do_not_propagate_mask = 0;
|
||||||
|
window_attributes->override_redirect = FALSE;
|
||||||
|
window_attributes->screen = NULL;
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
/* wxUSE_NANOX */
|
/* wxUSE_NANOX */
|
@@ -613,6 +613,7 @@ void wxWindowX11::DoGetSize(int *x, int *y) const
|
|||||||
wxCHECK_RET( xwindow, wxT("invalid window") );
|
wxCHECK_RET( xwindow, wxT("invalid window") );
|
||||||
|
|
||||||
XSync(wxGlobalDisplay(), False);
|
XSync(wxGlobalDisplay(), False);
|
||||||
|
|
||||||
XWindowAttributes attr;
|
XWindowAttributes attr;
|
||||||
Status status = XGetWindowAttributes( wxGlobalDisplay(), xwindow, &attr );
|
Status status = XGetWindowAttributes( wxGlobalDisplay(), xwindow, &attr );
|
||||||
wxASSERT(status);
|
wxASSERT(status);
|
||||||
|
Reference in New Issue
Block a user