mirror of https://github.com/buggins/dlangui.git
fixes
This commit is contained in:
parent
4bb0e5cf27
commit
b9616b6589
|
@ -540,7 +540,7 @@ class MLParser {
|
||||||
/// move to next token
|
/// move to next token
|
||||||
protected void nextToken() {
|
protected void nextToken() {
|
||||||
_token = _tokenizer.nextToken();
|
_token = _tokenizer.nextToken();
|
||||||
Log.d("parsed token: ", _token.type, " ", _token.line, ":", _token.pos, " ", _token.text);
|
//Log.d("parsed token: ", _token.type, " ", _token.line, ":", _token.pos, " ", _token.text);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// throw exception if current token is eof
|
/// throw exception if current token is eof
|
||||||
|
|
|
@ -34,7 +34,7 @@ class X11Window : dlangui.platforms.common.platform.Window {
|
||||||
this(X11Platform platform, dstring caption, dlangui.platforms.common.platform.Window parent, uint flags, uint width = 0, uint height = 0) {
|
this(X11Platform platform, dstring caption, dlangui.platforms.common.platform.Window parent, uint flags, uint width = 0, uint height = 0) {
|
||||||
_platform = platform;
|
_platform = platform;
|
||||||
_caption = caption;
|
_caption = caption;
|
||||||
debug Log.d("Creating SDL window");
|
debug Log.d("X11Window: Creating window");
|
||||||
_dx = width;
|
_dx = width;
|
||||||
_dy = height;
|
_dy = height;
|
||||||
//create(flags);
|
//create(flags);
|
||||||
|
@ -67,15 +67,18 @@ class X11Window : dlangui.platforms.common.platform.Window {
|
||||||
|
|
||||||
/* create the Graphics Context */
|
/* create the Graphics Context */
|
||||||
_gc = XCreateGC(x11display, _win, 0, cast(XGCValues*)null);
|
_gc = XCreateGC(x11display, _win, 0, cast(XGCValues*)null);
|
||||||
|
Log.d("X11Window: windowId=", _win, " gc=", _gc);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* here is another routine to set the foreground and background
|
/* here is another routine to set the foreground and background
|
||||||
colors _currently_ in use in the window.
|
colors _currently_ in use in the window.
|
||||||
*/
|
*/
|
||||||
XSetBackground(x11display, _gc, white);
|
//XSetBackground(x11display, _gc, white);
|
||||||
XSetForeground(x11display, _gc, black);
|
//XSetForeground(x11display, _gc, black);
|
||||||
|
|
||||||
/* clear the window and bring it on top of the other windows */
|
/* clear the window and bring it on top of the other windows */
|
||||||
XClearWindow(x11display, _win);
|
//XClearWindow(x11display, _win);
|
||||||
}
|
}
|
||||||
|
|
||||||
~this() {
|
~this() {
|
||||||
|
@ -110,6 +113,21 @@ class X11Window : dlangui.platforms.common.platform.Window {
|
||||||
/// close window
|
/// close window
|
||||||
override void close() {
|
override void close() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void processExpose() {
|
||||||
|
ulong black, white;
|
||||||
|
black = BlackPixel(x11display, x11screen); /* get color black */
|
||||||
|
white = WhitePixel(x11display, x11screen); /* get color white */
|
||||||
|
//XSetBackground(x11display, _gc, white);
|
||||||
|
XClearWindow(x11display, _win);
|
||||||
|
//XSetForeground ( x11display, _gc, white );
|
||||||
|
XFillRectangle(x11display, _win, _gc, 100, 200, 150, 300);
|
||||||
|
//XSetForeground ( x11display, _gc, black );
|
||||||
|
XDrawString ( x11display, _win, _gc, 20, 50,
|
||||||
|
cast(char*)"First example".ptr, "First example".length );
|
||||||
|
//XFreeGC ( x11display, gc );
|
||||||
|
XFlush(x11display);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class X11Platform : Platform {
|
class X11Platform : Platform {
|
||||||
|
@ -117,6 +135,8 @@ class X11Platform : Platform {
|
||||||
this() {
|
this() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
X11Window[x11.Xlib.Window] _windowMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* create window
|
* create window
|
||||||
* Args:
|
* Args:
|
||||||
|
@ -132,15 +152,23 @@ class X11Platform : Platform {
|
||||||
int newwidth = width;
|
int newwidth = width;
|
||||||
int newheight = height;
|
int newheight = height;
|
||||||
X11Window window = new X11Window(this, windowCaption, parent, flags, newwidth, newheight);
|
X11Window window = new X11Window(this, windowCaption, parent, flags, newwidth, newheight);
|
||||||
|
_windowMap[window._win] = window;
|
||||||
return window;
|
return window;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
X11Window findWindow(x11.Xlib.Window windowId) {
|
||||||
|
if (windowId in _windowMap)
|
||||||
|
return _windowMap[windowId];
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* close window
|
* close window
|
||||||
*
|
*
|
||||||
* Closes window earlier created with createWindow()
|
* Closes window earlier created with createWindow()
|
||||||
*/
|
*/
|
||||||
override void closeWindow(dlangui.platforms.common.platform.Window w) {
|
override void closeWindow(dlangui.platforms.common.platform.Window w) {
|
||||||
|
_windowMap.remove((cast(X11Window)w)._win);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -163,6 +191,10 @@ class X11Platform : Platform {
|
||||||
if (event.type==Expose && event.xexpose.count==0) {
|
if (event.type==Expose && event.xexpose.count==0) {
|
||||||
/* the window was exposed redraw it! */
|
/* the window was exposed redraw it! */
|
||||||
//redraw();
|
//redraw();
|
||||||
|
X11Window w = findWindow(event.xexpose.window);
|
||||||
|
if (w) {
|
||||||
|
w.processExpose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (event.type == KeyPress &&
|
if (event.type == KeyPress &&
|
||||||
XLookupString(&event.xkey, text.ptr, 255, &key, cast(XComposeStatus*)null) == 1) {
|
XLookupString(&event.xkey, text.ptr, 255, &key, cast(XComposeStatus*)null) == 1) {
|
||||||
|
@ -214,6 +246,7 @@ extern(C) int DLANGUImain(string[] args)
|
||||||
assert(false);
|
assert(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
currentTheme = createDefaultTheme();
|
||||||
|
|
||||||
/* use the information from the environment variable DISPLAY
|
/* use the information from the environment variable DISPLAY
|
||||||
to create the X connection:
|
to create the X connection:
|
||||||
|
@ -227,7 +260,8 @@ extern(C) int DLANGUImain(string[] args)
|
||||||
x11screen = DefaultScreen(x11display);
|
x11screen = DefaultScreen(x11display);
|
||||||
|
|
||||||
|
|
||||||
currentTheme = createDefaultTheme();
|
|
||||||
|
Log.d("X11 display=", x11display, " screen=", x11screen);
|
||||||
|
|
||||||
X11Platform x11platform = new X11Platform();
|
X11Platform x11platform = new X11Platform();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue