Fix Pango and ui.event-loop for Windows

db4
U-SLAVA-DFB8FF805\Slava 2009-03-02 01:12:06 -06:00
parent a7df2ffafc
commit 95de45725e
4 changed files with 22 additions and 19 deletions

4
basis/glib/glib.factor Normal file → Executable file
View File

@ -7,13 +7,13 @@ IN: glib
<<
"glib" {
{ [ os winnt? ] [ "glib2.dll" ] }
{ [ os winnt? ] [ "libglib-2.0-0.dll" ] }
{ [ os macosx? ] [ "/opt/local/lib/libglib-2.0.0.dylib" ] }
{ [ os unix? ] [ "libglib-2.0.0.so" ] }
} cond "cdecl" add-library
"gobject" {
{ [ os winnt? ] [ "gobject2.dll" ] }
{ [ os winnt? ] [ "libgobject-2.0-0.dll" ] }
{ [ os macosx? ] [ "/opt/local/lib/libgobject-2.0.0.dylib" ] }
{ [ os unix? ] [ "libgobject-2.0.0.so" ] }
} cond "cdecl" add-library

View File

@ -2,15 +2,15 @@
! Portions copyright (C) 2007, 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: alien alien.c-types alien.strings arrays assocs ui
ui.gadgets ui.backend ui.clipboards ui.gadgets.worlds
ui.gestures ui.event-loop io kernel math
math.vectors namespaces make sequences strings vectors words
windows.kernel32 windows.gdi32 windows.user32 windows.opengl32
windows.messages windows.types windows.nt windows threads libc
combinators fry combinators.short-circuit continuations
command-line shuffle opengl ui.render ascii math.bitwise locals
accessors math.rectangles math.order ascii calendar
io.encodings.utf16n ;
ui.private ui.gadgets ui.gadgets.private ui.backend
ui.clipboards ui.gadgets.worlds ui.gestures ui.event-loop io
kernel math math.vectors namespaces make sequences strings
vectors words windows.kernel32 windows.gdi32 windows.user32
windows.opengl32 windows.messages windows.types windows.nt
windows threads libc combinators fry combinators.short-circuit
continuations command-line shuffle opengl ui.render ascii
math.bitwise locals accessors math.rectangles math.order ascii
calendar io.encodings.utf16n ;
IN: ui.backend.windows
SINGLETON: windows-ui-backend
@ -25,8 +25,7 @@ SINGLETON: windows-ui-backend
0
[ EnumClipboardFormats win32-error dup dup 0 > ]
[ ]
[ drop ]
produce nip ;
produce 2nip ;
: with-clipboard ( quot -- )
f OpenClipboard win32-error=0/f

4
basis/ui/event-loop/event-loop.factor Normal file → Executable file
View File

@ -1,7 +1,7 @@
! Copyright (C) 2008 Slava Pestov.
! Copyright (C) 2008, 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: calendar combinators deques kernel namespaces sequences
threads ui ui.backend ui.gadgets ;
threads ui ui.private ui.backend ui.gadgets ui.gadgets.private ;
IN: ui.event-loop
: event-loop? ( -- ? )

12
basis/ui/text/pango/pango.factor Normal file → Executable file
View File

@ -2,7 +2,7 @@
! See http://factorcode.org/license.txt for BSD license.
USING: accessors alien.c-types assocs cache kernel math math.vectors
namespaces opengl.textures pango.cairo pango.layouts ui.gadgets.worlds
ui.text ui.text.private pango ;
ui.text ui.text.private pango sequences ;
IN: ui.text.pango
SINGLETON: pango-renderer
@ -10,7 +10,9 @@ SINGLETON: pango-renderer
M: pango-renderer init-text-rendering
<cache-assoc> >>text-handle drop ;
M: pango-renderer string-dim cached-layout logical-rect>> dim>> ;
M: pango-renderer string-dim
[ " " string-dim { 0 1 } v* ]
[ cached-layout logical-rect>> dim>> [ >integer ] map ] if-empty ;
M: pango-renderer finish-text-rendering
text-handle>> purge-cache
@ -31,9 +33,11 @@ M: pango-renderer offset>x ( n font string -- x )
cached-line swap line-offset>x ;
M: pango-renderer font-metrics ( font -- metrics )
"" cached-layout metrics>> clone f >>width ;
" " cached-layout metrics>> clone f >>width ;
M: pango-renderer line-metrics ( font string -- metrics )
cached-layout metrics>> ;
[ " " line-metrics clone 0 >>width ]
[ cached-layout metrics>> ]
if-empty ;
pango-renderer font-renderer set-global