Merge branch 'master' of github.com:adamdruppe/misc-stuff-including-D-programming-language-web-stuff

This commit is contained in:
Adam D. Ruppe 2012-06-30 22:52:31 -04:00
commit ca50fc2016
2 changed files with 54 additions and 51 deletions

View File

@ -148,7 +148,7 @@ void displayImage(Image image, SimpleWindow win = null) {
auto p = win.draw;
p.drawImage(Point(0, 0), image);
}
return win.eventLoop(0,
win.eventLoop(0,
(int) {
win.close();
} );
@ -700,8 +700,8 @@ version(Windows) {
case WM_MBUTTONUP:
case WM_MBUTTONDBLCLK:
mouse.type = 0;
mouse.x = GET_X_LPARAM(lParam);
mouse.y = GET_Y_LPARAM(lParam);
mouse.x = LOWORD(lParam);
mouse.y = HIWORD(lParam);
mouse.buttonFlags = wParam;
if(handleMouseEvent)
@ -1384,18 +1384,23 @@ enum ColorMapNotification:int
struct _XPrivate {}
struct _XrmHashBucketRec {}
typedef void* XPointer;
typedef void* XExtData;
alias void* XPointer;
alias void* XExtData;
alias uint XID;
typedef XID Window;
typedef XID Drawable;
typedef XID Pixmap;
alias XID Window;
alias XID Drawable;
alias XID Pixmap;
alias uint Atom;
alias bool Bool;
alias Display XDisplay;
typedef int ByteOrder;
typedef uint Time;
typedef void ScreenFormat;
alias int ByteOrder;
alias uint Time;
alias void ScreenFormat;
struct XImage {
int width, height; /* size of image */
@ -1454,8 +1459,8 @@ struct XKeyEvent
uint keycode; /* detail */
Bool same_screen; /* same screen flag */
}
typedef XKeyEvent XKeyPressedEvent;
typedef XKeyEvent XKeyReleasedEvent;
alias XKeyEvent XKeyPressedEvent;
alias XKeyEvent XKeyReleasedEvent;
struct XButtonEvent
{
@ -1473,8 +1478,8 @@ struct XButtonEvent
uint button; /* detail */
Bool same_screen; /* same screen flag */
}
typedef XButtonEvent XButtonPressedEvent;
typedef XButtonEvent XButtonReleasedEvent;
alias XButtonEvent XButtonPressedEvent;
alias XButtonEvent XButtonReleasedEvent;
struct XMotionEvent{
int type; /* of event */
@ -1491,7 +1496,7 @@ struct XMotionEvent{
byte is_hint; /* detail */
Bool same_screen; /* same screen flag */
}
typedef XMotionEvent XPointerMovedEvent;
alias XMotionEvent XPointerMovedEvent;
struct XCrossingEvent{
int type; /* of event */
@ -1514,8 +1519,8 @@ struct XCrossingEvent{
Bool focus; /* Boolean focus */
KeyOrButtonMask state; /* key or button mask */
}
typedef XCrossingEvent XEnterWindowEvent;
typedef XCrossingEvent XLeaveWindowEvent;
alias XCrossingEvent XEnterWindowEvent;
alias XCrossingEvent XLeaveWindowEvent;
struct XFocusChangeEvent{
int type; /* FocusIn or FocusOut */
@ -1532,8 +1537,8 @@ struct XFocusChangeEvent{
* NotifyPointerRoot, NotifyDetailNone
*/
}
typedef XFocusChangeEvent XFocusInEvent;
typedef XFocusChangeEvent XFocusOutEvent;
alias XFocusChangeEvent XFocusInEvent;
alias XFocusChangeEvent XFocusOutEvent;
Window XCreateSimpleWindow(
Display* /* display */,
Window /* parent */,
@ -1565,7 +1570,7 @@ Atom XInternAtom(
Bool /* only_if_exists */
);
typedef int Status;
alias int Status;
enum EventMask:int
@ -2079,10 +2084,10 @@ struct Depth
Visual *visuals; /* list of visuals possible at this depth */
}
typedef void* GC;
alias void* GC;
alias int VisualID;
typedef XID Colormap;
typedef XID KeySym;
alias XID Colormap;
alias XID KeySym;
alias uint KeyCode;
struct Screen{

14
web.d
View File

@ -1532,7 +1532,7 @@ Form createAutomaticForm(Document document, string action, in Parameter[] parame
}
count++;
};
}
auto fmt = Element.make("select");
fmt.name = "format";
@ -2175,7 +2175,6 @@ string formatAs(T, R)(T ret, string format, R api = null, JSONValue* returnValue
else goto badType;
+/
goto badType; // FIXME
break;
case "json":
assert(returnValue !is null);
*returnValue = toJsonValue!(typeof(ret), R)(ret, formatJsonToStringAs, api);
@ -2731,13 +2730,12 @@ immutable(string[]) weekdayNames = [
// this might be temporary
struct TemplateFilters {
string date(string replacement, string[], in Element, string) {
auto date = to!long(replacement);
auto dateTicks = to!time_t(replacement);
auto date = SysTime( unixTimeToStdTime(dateTicks/1_000) );
import std.date;
auto day = dateFromTime(date);
auto year = yearFromTime(date);
auto month = monthNames[monthFromTime(date)];
auto day = date.day;
auto year = date.year;
auto month = monthNames[date.month];
replacement = format("%s %d, %d", month, day, year);
return replacement;