From efbfa4e3c1d5447d7d0a278810862b68983b0bff Mon Sep 17 00:00:00 2001 From: Oldes Date: Sat, 5 Aug 2023 21:12:57 +0200 Subject: [PATCH] CHANGE: moved `event-keys` and `event-types` from `system/view` to `system/catalog`, because these are used not only in GUI --- make/tools/make-boot.reb | 4 +- src/boot/sysobj.reb | 184 +++++++++++++++++++-------------------- src/core/t-event.c | 8 +- 3 files changed, 98 insertions(+), 98 deletions(-) diff --git a/make/tools/make-boot.reb b/make/tools/make-boot.reb index 579d1315bd..a01a3723ff 100644 --- a/make/tools/make-boot.reb +++ b/make/tools/make-boot.reb @@ -793,7 +793,7 @@ 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^/"] @@ -801,7 +801,7 @@ 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^/"] diff --git a/src/boot/sysobj.reb b/src/boot/sysobj.reb index 6e88ee8e0c..b94220e153 100644 --- a/src/boot/sysobj.reb +++ b/src/boot/sysobj.reb @@ -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 [ @@ -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 diff --git a/src/core/t-event.c b/src/core/t-event.c index 75b50a6ece..176327c3d3 100644 --- a/src/core/t-event.c +++ b/src/core/t-event.c @@ -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++) { @@ -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++) { @@ -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; @@ -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;