Skip to content

Commit ce0e920

Browse files
committed
fix: Add HANDLE_SOM in event handlers
fixes sciter-sdk#235
1 parent 666da95 commit ce0e920

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

sciter.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1508,8 +1508,13 @@ func goElementEventProc(tag unsafe.Pointer, he C.HELEMENT, evtg uint, params uns
15081508
p := (*GestureParams)(params)
15091509
handled = handler.OnGesture(el, p)
15101510
}
1511+
case HANDLE_SOM:
1512+
if handler.OnSom != nil {
1513+
p := (*SomParams)(params)
1514+
handled := handler.OnSom(el, p)
1515+
}
15111516
default:
1512-
log.Panic("Unhandled sciter event case: ", evtg)
1517+
log.Panicf("Unhandled sciter event case: 0x%04X.\nCheck `EVENT_GROUPS` in sciter-x-behavior.h in the latest Sciter SDK", evtg)
15131518
}
15141519
if handled {
15151520
return 1

types.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ const (
7979

8080
HANDLE_EXCHANGE = 0x1000 /** system drag-n-drop */
8181
HANDLE_GESTURE = 0x2000 /** touch input events */
82+
HANDLE_SOM = 0x8000 /** som_asset_t request */
8283

8384
HANDLE_ALL = 0xFFFF /* all of them */
8485

@@ -802,6 +803,14 @@ type GestureParams struct {
802803
DeltaV float64
803804
}
804805

806+
type SomEvents uint32
807+
const (
808+
SOM_GET_PASSPORT = 0
809+
SOM_GET_ASSET = 1
810+
)
811+
812+
type SomParams C.SOM_PARAMS
813+
805814
const (
806815
LOAD_OK = 0 // do default loading if data not set
807816
LOAD_DISCARD = 1 // discard request completely
@@ -1221,6 +1230,7 @@ type EventHandler struct {
12211230
OnScroll func(he *Element, params *ScrollParams) bool
12221231
OnExchange func(he *Element, params *ExchangeParams) bool
12231232
OnGesture func(he *Element, params *GestureParams) bool
1233+
OnSom func(he *Element, params *SomParams) bool
12241234
}
12251235

12261236
// case SC_LOAD_DATA: return static_cast<BASE*>(this)->on_load_data((LPSCN_LOAD_DATA) pnm);

0 commit comments

Comments
 (0)