Update X11 UI backend to handle focus and window motion events (untested)
parent
289f63e655
commit
c35a4b63b9
|
@ -10,8 +10,7 @@
|
||||||
- code walker & exceptions -- test and debug problems
|
- code walker & exceptions -- test and debug problems
|
||||||
- another i/o bug: on factorcode eventually all i/o times out
|
- another i/o bug: on factorcode eventually all i/o times out
|
||||||
- x11 title bars are funny
|
- x11 title bars are funny
|
||||||
- save window positions on x11
|
- quit fep
|
||||||
- do top-level window focus on x11
|
|
||||||
- if the listener is running a command when the image is saved, it
|
- if the listener is running a command when the image is saved, it
|
||||||
restores to an unresponsive gadget
|
restores to an unresponsive gadget
|
||||||
- track: don't allow negative dimensions
|
- track: don't allow negative dimensions
|
||||||
|
|
|
@ -6,7 +6,7 @@ namespaces prettyprint sequences strings threads ;
|
||||||
|
|
||||||
GENERIC: expose-event ( event window -- )
|
GENERIC: expose-event ( event window -- )
|
||||||
|
|
||||||
GENERIC: resize-event ( event window -- )
|
GENERIC: configure-event ( event window -- )
|
||||||
|
|
||||||
GENERIC: button-down-event ( event window -- )
|
GENERIC: button-down-event ( event window -- )
|
||||||
|
|
||||||
|
@ -20,6 +20,10 @@ GENERIC: key-down-event ( event window -- )
|
||||||
|
|
||||||
GENERIC: key-up-event ( event window -- )
|
GENERIC: key-up-event ( event window -- )
|
||||||
|
|
||||||
|
GENERIC: focus-in-event ( event window -- )
|
||||||
|
|
||||||
|
GENERIC: focus-out-event ( event window -- )
|
||||||
|
|
||||||
GENERIC: client-event ( event window -- )
|
GENERIC: client-event ( event window -- )
|
||||||
|
|
||||||
: next-event ( -- event )
|
: next-event ( -- event )
|
||||||
|
@ -45,12 +49,14 @@ GENERIC: client-event ( event window -- )
|
||||||
: handle-event ( event window -- )
|
: handle-event ( event window -- )
|
||||||
over XAnyEvent-type {
|
over XAnyEvent-type {
|
||||||
{ [ dup Expose = ] [ drop expose-event ] }
|
{ [ dup Expose = ] [ drop expose-event ] }
|
||||||
{ [ dup ConfigureNotify = ] [ drop resize-event ] }
|
{ [ dup ConfigureNotify = ] [ drop configure-event ] }
|
||||||
{ [ dup ButtonPress = ] [ drop button-down-event$ ] }
|
{ [ dup ButtonPress = ] [ drop button-down-event$ ] }
|
||||||
{ [ dup ButtonRelease = ] [ drop button-up-event$ ] }
|
{ [ dup ButtonRelease = ] [ drop button-up-event$ ] }
|
||||||
{ [ dup MotionNotify = ] [ drop motion-event ] }
|
{ [ dup MotionNotify = ] [ drop motion-event ] }
|
||||||
{ [ dup KeyPress = ] [ drop key-down-event ] }
|
{ [ dup KeyPress = ] [ drop key-down-event ] }
|
||||||
{ [ dup KeyRelease = ] [ drop key-up-event ] }
|
{ [ dup KeyRelease = ] [ drop key-up-event ] }
|
||||||
|
{ [ dup FocusIn = ] [ drop focus-in-event ] }
|
||||||
|
{ [ dup FocusOut = ] [ drop focus-out-event ] }
|
||||||
{ [ dup ClientMessage = ] [ drop client-event ] }
|
{ [ dup ClientMessage = ] [ drop client-event ] }
|
||||||
{ [ t ] [ 3drop ] }
|
{ [ t ] [ 3drop ] }
|
||||||
} cond ;
|
} cond ;
|
||||||
|
|
|
@ -12,11 +12,17 @@ strings x11 ;
|
||||||
|
|
||||||
M: world expose-event ( event world -- ) nip relayout ;
|
M: world expose-event ( event world -- ) nip relayout ;
|
||||||
|
|
||||||
M: world resize-event ( event world -- )
|
: configured-loc ( event -- dim )
|
||||||
>r
|
dup XConfigureEvent-x swap XConfigureEvent-y
|
||||||
|
0 3array ;
|
||||||
|
|
||||||
|
: configured-dim ( event -- dim )
|
||||||
dup XConfigureEvent-width swap XConfigureEvent-height 0
|
dup XConfigureEvent-width swap XConfigureEvent-height 0
|
||||||
3array
|
3array ;
|
||||||
r> set-gadget-dim ;
|
|
||||||
|
M: world configure-event ( event world -- )
|
||||||
|
over configured-loc over set-world-loc
|
||||||
|
swap configured-dim swap set-gadget-dim ;
|
||||||
|
|
||||||
: button&loc ( event -- button# loc )
|
: button&loc ( event -- button# loc )
|
||||||
dup XButtonEvent-button
|
dup XButtonEvent-button
|
||||||
|
@ -94,6 +100,10 @@ M: world key-up-event ( event world -- )
|
||||||
2drop
|
2drop
|
||||||
] if* ;
|
] if* ;
|
||||||
|
|
||||||
|
M: world focus-in-event ( event world -- ) nip focus-world ;
|
||||||
|
|
||||||
|
M: world focus-out-event ( event world -- ) nip unfocus-world ;
|
||||||
|
|
||||||
: close-box? ( event -- ? )
|
: close-box? ( event -- ? )
|
||||||
dup XClientMessageEvent-message_type "WM_PROTOCOLS" x-atom =
|
dup XClientMessageEvent-message_type "WM_PROTOCOLS" x-atom =
|
||||||
swap XClientMessageEvent-data "WM_DELETE_WINDOW" x-atom =
|
swap XClientMessageEvent-data "WM_DELETE_WINDOW" x-atom =
|
||||||
|
|
|
@ -18,7 +18,8 @@ USING: alien gadgets hashtables kernel math namespaces sequences ;
|
||||||
KeyReleaseMask bitor
|
KeyReleaseMask bitor
|
||||||
ButtonPressMask bitor
|
ButtonPressMask bitor
|
||||||
ButtonReleaseMask bitor
|
ButtonReleaseMask bitor
|
||||||
PointerMotionMask bitor ;
|
PointerMotionMask bitor
|
||||||
|
FocusChangeMask bitor ;
|
||||||
|
|
||||||
: window-attributes ( visinfo -- attributes )
|
: window-attributes ( visinfo -- attributes )
|
||||||
"XSetWindowAttributes" <c-object>
|
"XSetWindowAttributes" <c-object>
|
||||||
|
|
Loading…
Reference in New Issue