/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
final public class XlibWrapper
{
// strange constants
// define a private constructor here to prevent this class and all
// its descendants from being created
private XlibWrapper()
{
}
/*
Display *XOpenDisplay(display_name)
char *display_name;
*/
{"<none:0>", "<none:1>", "KeyPress", "KeyRelease", "ButtonPress", "ButtonRelease",
"MotionNotify", "EnterNotify", "LeaveNotify", "FocusIn", "FocusOut",
"KeymapNotify", "Expose", "GraphicsExpose", "NoExpose", "VisibilityNotify",
"CreateNotify", "DestroyNotify", "UnmapNotify", "MapNotify", "MapRequest",
"ReparentNotify", "ConfigureNotify", "ConfigureRequest", "GravityNotify",
"ResizeRequest", "CirculateNotify", "CirculateRequest", "PropertyNotify",
"SelectionClear", "SelectionRequest", "SelectionNotify", "ColormapNotify",
"ClientMessage", "MappingNotify", "LASTEvent"};
/**
* Gets byte string from str_ptr and copies it into byte array
* String should be NULL terminated
*/
/*
Window XCreateWindow(display, parent, x, y, width, height,
border_width, depth,
class, visual, valuemask, attributes)
Display *display;
Window parent;
int x, y;
unsigned int width, height;
unsigned int border_width;
int depth;
unsigned int class;
Visual *visual
unsigned long valuemask;
XSetWindowAttributes *attributes;
*/
static native long XCreateWindow(long display, long parent, int x,int y, int width, int height, int border_width, int depth, long wclass, long visual, long valuemask, long attributes);
int owner_events, int pointer_mode,
int keyboard_mode, long time);
/*
void XSetWMProperties(display, w, window_name, icon_name,
argv, argc, normal_hints, wm_hints, class_hints)
Display *display;
Window w;
XTextProperty *window_name;
XTextProperty *icon_name;
char **argv;
int argc;
XSizeHints *normal_hints;
XWMHints *wm_hints;
XClassHint *class_hints;
*/
/*
XMapWindow(display, w)
Display *display;
Window w;
*/
long value_mask, long values);
/*
XUnmapWindow(display, w)
Display *display;
Window w;
*/
/*
XSelectInput(display, w, event_mask)
Display *display;
Window w;
long event_mask;
*/
/*
XNextEvent(display, event_return)
Display *display;
XEvent *event_return;
*/
/*
XMaskEvent(display, event_mask, event_return)
Display *display;
long event_mask;
XEvent *event_return;
*/
/*
Bool XFilterEvent(event, w)
XEvent *event;
Window w;
*/
/*
Bool XSupportsLocale()
*/
static native boolean XSupportsLocale();
/*
char *XSetLocaleModifiers(modifier_list)
char *modifier_list;
*/
static native int XTranslateCoordinates(
long dest_x_return, long dest_y_return,
long child_return);
/*
XPeekEvent(display, event_return)
Display *display;
XEvent *event_return;
*/
/*
XFlush(display)
Display *display;
*/
/*
XSync(display, discard)
Display *display;
Bool discard;
*/
/* XMoveResizeWindow(display, w, x, y, width, height)
Display *display;
Window w;
int x, y;
unsigned int width, height;
*/
static native void XMoveResizeWindow(long display, long window, int x, int y, int width, int height);
/*
Bool XQueryPointer(display, w, root_return, child_return,
root_x_return, root_y_return,
win_x_return, win_y_return,
mask_return)
Display *display;
Window w;
Window *root_return, *child_return;
int *root_x_return, *root_y_return;
int *win_x_return, *win_y_return;
unsigned int *mask_return;
*/
static native boolean XQueryPointer (long display, long window, long root_return, long child_return, long root_x_return, long root_y_return, long win_x_return, long win_y_return, long mask_return);
/* XFreeCursor(display, cursor)
Display *display;
Cursor cursor;
*/
/*
XSetWindowBackground(display, w, background_pixel)
Display *display;
Window w;
unsigned long background_pixel;
*/
/*
Atom XInternAtom(display, atom_name, only_if_exists)
Display *display;
char *atom_name;
Bool only_if_exists;
*/
long long_offset, long long_length,
long actualy_format, long nitems_ptr,
long bytes_after, long data_ptr);
int nelements);
int nelements) {
// TODO: handling of XChangePropertyImpl return value, if not Success - don't cache
if (XPropertyCache.isCachingSupported() &&
{
0,
data,
length),
}
}
static native long XAllocWMHints();
/*
Cursor XCreateFontCursor(display, shape)
Display *display;
unsigned int shape;
we always pass int as shape param.
perhaps later we will need to change type of shape to long.
*/
/*
Pixmap XCreateBitmapFromData(display, d, data, width,
height)
Display *display;
Drawable d;
char *data;
unsigned int width, height;
*/
static native long XCreateBitmapFromData(long display, long drawable, long data, int width, int height);
/*
XFreePixmap(display, pixmap)
Display *display;
Pixmap pixmap;
*/
/*
Cursor XCreatePixmapCursor(display, source, mask,
foreground_color, background_color, x, y)
Display *display;
Pixmap source;
Pixmap mask;
XColor *foreground_color;
XColor *background_color;
unsigned int x, y;
*/
static native long XCreatePixmapCursor(long display, long source, long mask, long fore, long back, int x, int y);
/*
Status XQueryBestCursor(display, d, width, height,
width_return, height_return)
Display *display;
Drawable d;
unsigned int width, height;
unsigned int *width_return, *height_return;
*/
static native boolean XQueryBestCursor(long display, long drawable, int width, int height, long width_return, long height_return);
/*
Status XAllocColor(display, colormap, screen_in_out)
Display *display;
Colormap colormap;
XColor *screen_in_out;
*/
static native long SetToolkitErrorHandler();
/*
XChangeWindowAttributes(display, w, valuemask, attributes)
Display *display;
Window w;
unsigned long valuemask;
XSetWindowAttributes *attributes;
*/
static native void XChangeWindowAttributes(long display, long window, long valuemask, long attributes);
static native int XGetGeometry(long display, long drawable, long root_return, long x_return, long y_return,
static native void XSetMinMaxHints(long display, long window, int x, int y, int width, int height, long flags);
static native long XAllocSizeHints();
static native int XSendEvent(long display, long window, boolean propagate, long event_mask, long event);
static native int XQueryTree(long display, long window, long root_return, long parent_return, long children_return, long nchildren_return);
static native long XGetVisualInfo(long display, long vinfo_mask, long vinfo_template, long nitems_return);
int bytes_per_line);
long minor_version_return);
long feve_return, long err_return);
// xkb-related
static native void XkbSelectEvents(long display, long device, long bits_to_change, long values_for_bits);
long bits_to_change, long values_for_bits);
static native boolean XkbTranslateKeyCode(long xkb, int keycode, long mods, long mods_rtrn, long keysym_rtrn);
long keysym_lowercase,
long keysym_uppercase);
/*
int (*XSynchronize(Display *display, Bool onoff))();
display Specifies the connection to the X server.
onoff Specifies a Boolean value that indicates whether to enable or disable synchronization.
*/
/**
* Extracts an X event that can be processed in a secondary loop.
* Should only be called on the toolkit thread.
* Returns false if this secondary event was terminated.
*/
/**
* Terminates the topmost secondary loop (if any).
* Should never be called on the toolkit thread.
*/
static native void ExitSecondaryLoop();
/**
* Calls XTextPropertyToStringList on the specified byte array and returns
* the array of strings.
*/
/**
* XSHAPE extension support.
*/
static native boolean XShapeQueryExtension(long display, long event_base_return, long error_base_return);
/** Each int in the bitmap array is one pixel with a 32-bit color:
* R, G, B, and Alpha.
*/
/* Global memory area used for X lib parameter passing */
static int dataModel;
static final boolean isBuildInternal;
static {
new GetPropertyAction("sun.arch.data.model"));
try {
} catch (Exception e) {
dataModel = 32;
}
// System.loadLibrary("mawt");
}
static int getDataModel() {
return dataModel;
}
}
}
}
}
}
}
}
}
return eventToString[type];
//XXX TODO various xkb types
return "XkbEvent";
}
return eventToString[0];
}
private static boolean getBuildInternal() {
new GetPropertyAction("java.version"));
}
}