Skip to content

Commit

Permalink
CHANGE: moved event-keys and event-types from system/view to `s…
Browse files Browse the repository at this point in the history
…ystem/catalog`, because these are used not only in GUI
  • Loading branch information
Oldes committed Aug 5, 2023
1 parent ef38d10 commit efbfa4e
Show file tree
Hide file tree
Showing 3 changed files with 98 additions and 98 deletions.
4 changes: 2 additions & 2 deletions make/tools/make-boot.reb
Original file line number Diff line number Diff line change
Expand Up @@ -793,15 +793,15 @@ emit-head "Event Types" %reb-evtypes.h
emit newline

emit ["enum event_types {" newline]
foreach field ob/view/event-types [
foreach field ob/catalog/event-types [
emit-line "EVT_" field none
]
emit [tab "EVT_MAX^/"]
emit "};^/^/"

emit ["enum event_keys {" newline]
emit-line "EVK_" "NONE" none
foreach field ob/view/event-keys [
foreach field ob/catalog/event-keys [
emit-line "EVK_" field none
]
emit [tab "EVK_MAX^/"]
Expand Down
184 changes: 92 additions & 92 deletions src/boot/sysobj.reb
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,98 @@ catalog: object [
ciphers: [
; will be filled on boot from `Init_Crypt` in `n-crypt.c`
]
event-types: [
; Event types. Order dependent for C and REBOL.
; Due to fixed C constants, this list cannot be reordered after release!
ignore ; ignore event (0)
interrupt ; user interrupt
device ; misc device request
callback ; callback event
custom ; custom events
error
init

open
close
connect
accept
read
write
wrote
lookup

ready
done
time

show
hide
offset
resize
active
inactive
minimize
maximize
restore

move
down
up
alt-down
alt-up
aux-down
aux-up
key
key-up ; Move above when version changes!!!

scroll-line
scroll-page

drop-file

click
change
focus
unfocus
scroll

control ;; used to pass control key events to a console port
control-up ;; only on Windows?
]
event-keys: [
; Event types. Order dependent for C and REBOL.
; Due to fixed C constants, this list cannot be reordered after release!
page-up
page-down
end
home
left
up
right
down
insert
delete
f1
f2
f3
f4
f5
f6
f7
f8
f9
f10
f11
f12
paste-start ;; Bracketed paste turned on - https://cirw.in/blog/bracketed-paste
paste-end ;; Bracketed paste turned off
escape ;; Escape key
shift
control
alt
pause
capital
]
]

contexts: construct [
Expand Down Expand Up @@ -453,98 +545,6 @@ view: object [
work-origin:
work-size: 0x0
]
event-types: [
; Event types. Order dependent for C and REBOL.
; Due to fixed C constants, this list cannot be reordered after release!
ignore ; ignore event (0)
interrupt ; user interrupt
device ; misc device request
callback ; callback event
custom ; custom events
error
init

open
close
connect
accept
read
write
wrote
lookup

ready
done
time

show
hide
offset
resize
active
inactive
minimize
maximize
restore

move
down
up
alt-down
alt-up
aux-down
aux-up
key
key-up ; Move above when version changes!!!

scroll-line
scroll-page

drop-file

click
change
focus
unfocus
scroll

control ;; used to pass control key events to a console port
control-up ;; only on Windows?
]
event-keys: [
; Event types. Order dependent for C and REBOL.
; Due to fixed C constants, this list cannot be reordered after release!
page-up
page-down
end
home
left
up
right
down
insert
delete
f1
f2
f3
f4
f5
f6
f7
f8
f9
f10
f11
f12
paste-start ;; Bracketed paste turned on - https://cirw.in/blog/bracketed-paste
paste-end ;; Bracketed paste turned off
escape ;; Escape key
shift
control
alt
pause
capital
]
]

license: none
Expand Down
8 changes: 4 additions & 4 deletions src/core/t-event.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@

case SYM_TYPE:
if (!IS_WORD(val) && !IS_LIT_WORD(val)) return FALSE;
arg = Get_System(SYS_VIEW, VIEW_EVENT_TYPES);
arg = Get_System(SYS_CATALOG, CAT_EVENT_TYPES);
if (IS_BLOCK(arg)) {
w = VAL_WORD_CANON(val);
for (n = 0, arg = VAL_BLK(arg); NOT_END(arg); arg++, n++) {
Expand Down Expand Up @@ -141,7 +141,7 @@
break;
}
else if (IS_LIT_WORD(val) || IS_WORD(val)) {
arg = Get_System(SYS_VIEW, VIEW_EVENT_KEYS);
arg = Get_System(SYS_CATALOG, CAT_EVENT_KEYS);
if (IS_BLOCK(arg)) {
arg = VAL_BLK_DATA(arg);
for (n = VAL_INDEX(arg); NOT_END(arg); n++, arg++) {
Expand Down Expand Up @@ -208,7 +208,7 @@

case SYM_TYPE:
if (VAL_EVENT_TYPE(value) == 0) goto is_none;
arg = Get_System(SYS_VIEW, VIEW_EVENT_TYPES);
arg = Get_System(SYS_CATALOG, CAT_EVENT_TYPES);
if (IS_BLOCK(arg) && VAL_TAIL(arg) >= EVT_MAX) {
*val = *VAL_BLK_SKIP(arg, VAL_EVENT_TYPE(value));
break;
Expand Down Expand Up @@ -271,7 +271,7 @@
break;
}
else if (VAL_EVENT_TYPE(value) == EVT_CONTROL || VAL_EVENT_TYPE(value) == EVT_CONTROL_UP) {
arg = Get_System(SYS_VIEW, VIEW_EVENT_KEYS);
arg = Get_System(SYS_CATALOG, CAT_EVENT_KEYS);
if (IS_BLOCK(arg) && n <= (REBINT)VAL_TAIL(arg)) {
*val = *VAL_BLK_SKIP(arg, n-1);
break;
Expand Down

0 comments on commit efbfa4e

Please sign in to comment.