Skip to content

Commit

Permalink
[WAPI] Readable window message names
Browse files Browse the repository at this point in the history
  • Loading branch information
PeyTy committed Dec 11, 2023
1 parent 2cad95e commit b4bd42f
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 75 deletions.
132 changes: 66 additions & 66 deletions dlls/types.hexa
Original file line number Diff line number Diff line change
Expand Up @@ -86,81 +86,81 @@ enum Message : UInt32 {
WM_MOVE = 0x0003
WM_SIZE = 0x0005
WM_ACTIVATE = 0x0006
WM_SETFOCUS = 0x0007
WM_KILLFOCUS = 0x0008
WM_SET_FOCUS = 0x0007
WM_KILL_FOCUS = 0x0008
WM_ENABLE = 0x000A
WM_SETREDRAW = 0x000B
WM_SETTEXT = 0x000C
WM_GETTEXT = 0x000D
WM_GETTEXTLENGTH = 0x000E
WM_SET_REDRAW = 0x000B
WM_SET_TEXT = 0x000C
WM_GET_TEXT = 0x000D
WM_GET_TEXT_LENGTH = 0x000E
WM_PAINT = 0x000F
WM_CLOSE = 0x0010
WM_QUERYENDSESSION = 0x0011
WM_QUERY_END_SESSION = 0x0011
WM_QUIT = 0x0012
WM_QUERYOPEN = 0x0013
WM_ERASEBKGND = 0x0014
WM_SYSCOLORCHANGE = 0x0015
WM_ENDSESSION = 0x0016
WM_SHOWWINDOW = 0x0018
WM_ACTIVATEAPP = 0x001C
WM_SETCURSOR = 0x0020
WM_MOUSEACTIVATE = 0x0021
WM_CHILDACTIVATE = 0x0022
WM_QUEUESYNC = 0x0023
WM_GETMINMAXINFO = 0x0024
WM_CONTEXTMENU = 0x007B
WM_STYLECHANGING = 0x007C
WM_STYLECHANGED = 0x007D
WM_DISPLAYCHANGE = 0x007E
WM_GETICON = 0x007F
WM_SETICON = 0x0080
WM_NCCREATE = 0x0081
WM_NCDESTROY = 0x0082
WM_NCCALCSIZE = 0x0083
WM_NCHITTEST = 0x0084
WM_NCPAINT = 0x0085
WM_NCACTIVATE = 0x0086
WM_GETDLGCODE = 0x0087
WM_SYNCPAINT = 0x0088
WM_NCMOUSEMOVE = 0x00A0
WM_NCLBUTTONDOWN = 0x00A1
WM_NCLBUTTONUP = 0x00A2
WM_NCLBUTTONDBLCLK = 0x00A3
WM_NCRBUTTONDOWN = 0x00A4
WM_NCRBUTTONUP = 0x00A5
WM_NCRBUTTONDBLCLK = 0x00A6
WM_NCMBUTTONDOWN = 0x00A7
WM_NCMBUTTONUP = 0x00A8
WM_NCMBUTTONDBLCLK = 0x00A9
BM_GETCHECK = 0x00F0
BM_SETCHECK = 0x00F1
BM_GETSTATE = 0x00F2
BM_SETSTATE = 0x00F3
BM_SETSTYLE = 0x00F4
WM_QUERY_OPEN = 0x0013
WM_ERASE_BACKGROUND = 0x0014
WM_SYS_COLOR_CHANGE = 0x0015
WM_END_SESSION = 0x0016
WM_SHOW_WINDOW = 0x0018
WM_ACTIVATE_APP = 0x001C
WM_SET_CURSOR = 0x0020
WM_MOUSE_ACTIVATE = 0x0021
WM_CHILD_ACTIVATE = 0x0022
WM_QUEUE_SYNC = 0x0023
WM_GET_MIN_MAX_INFO = 0x0024
WM_CONTEXT_MENU = 0x007B
WM_STYLE_CHANGING = 0x007C
WM_STYLE_CHANGED = 0x007D
WM_DISPLAY_CHANGE = 0x007E
WM_GET_ICON = 0x007F
WM_SET_ICON = 0x0080
WM_NC_CREATE = 0x0081
WM_NC_DESTROY = 0x0082
WM_NC_CALC_SIZE = 0x0083
WM_NC_HIT_TEST = 0x0084
WM_NC_PAINT = 0x0085
WM_NC_ACTIVATE = 0x0086
WM_GET_DLG_CODE = 0x0087
WM_SYNC_PAINT = 0x0088
WM_NC_MOUSE_MOVE = 0x00A0
WM_NC_L_BUTTON_DOWN = 0x00A1
WM_NC_L_BUTTON_UP = 0x00A2
WM_NC_L_BUTTON_DBL_CLK = 0x00A3
WM_NC_R_BUTTON_DOWN = 0x00A4
WM_NC_R_BUTTON_UP = 0x00A5
WM_NC_R_BUTTON_DBL_CLK = 0x00A6
WM_NC_M_BUTTON_DOWN = 0x00A7
WM_NC_M_BUTTON_UP = 0x00A8
WM_NC_M_BUTTON_DBL_CLK = 0x00A9
BM_GET_CHECK = 0x00F0
BM_SET_CHECK = 0x00F1
BM_GET_STATE = 0x00F2
BM_SET_STATE = 0x00F3
BM_SET_STYLE = 0x00F4
BM_CLICK = 0x00F5
BM_GETIMAGE = 0x00F6
BM_SETIMAGE = 0x00F7
WM_KEYFIRST = 0x0100
WM_KEYDOWN = WM_KEYFIRST // 0x0100
WM_KEYUP = 0x0101
BM_GET_IMAGE = 0x00F6
BM_SET_IMAGE = 0x00F7
WM_KEY_FIRST = 0x0100
WM_KEY_DOWN = WM_KEY_FIRST // 0x0100
WM_KEY_UP = 0x0101
WM_CHAR = 0x0102
WM_DEADCHAR = 0x0103
WM_SYSKEYDOWN = 0x0104
WM_SYSKEYUP = 0x0105
WM_SYSCHAR = 0x0106
WM_SYSDEADCHAR = 0x0107
WM_KEYLAST = 0x0108
WM_INITDIALOG = 0x0110
WM_DEAD_CHAR = 0x0103
WM_SYS_KEY_DOWN = 0x0104
WM_SYS_KEY_UP = 0x0105
WM_SYS_CHAR = 0x0106
WM_SYS_DEAD_CHAR = 0x0107
WM_KEY_LAST = 0x0108
WM_INIT_DIALOG = 0x0110
WM_COMMAND = 0x0111
WM_SYSCOMMAND = 0x0112
WM_TIMER = 0x0113
WM_MOUSEMOVE = 0x0200
WM_LBUTTONDOWN = 0x0201
WM_LBUTTONUP = 0x0202
WM_RBUTTONDOWN = 0x0204
WM_RBUTTONUP = 0x0205
WM_MBUTTONDOWN = 0x0207
WM_MBUTTONUP = 0x0208
WM_MOUSE_MOVE = 0x0200
WM_L_BUTTON_DOWN = 0x0201
WM_L_BUTTON_UP = 0x0202
WM_R_BUTTON_DOWN = 0x0204
WM_R_BUTTON_UP = 0x0205
WM_M_BUTTON_DOWN = 0x0207
WM_M_BUTTON_UP = 0x0208
WM_SIZING = 0x0214
}

Expand Down
4 changes: 2 additions & 2 deletions dlls/user32.dll/user32.hexa
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ fun defWindowProcW(hWnd HWnd, uMsg Message, wParam WParam, lParam LParam) LResul
// TODO probably should be async post?
// TODO call proc with an asm wrapper which sets red-zone and extra stack/reg safety
window.proc(hWnd, Message.WM_DESTROY, null, null)
window.proc(hWnd, Message.WM_NCDESTROY, null, null)
window.proc(hWnd, Message.WM_NC_DESTROY, null, null)
return null
}
tofitaDebugLog("DefWindowProcW done".utf16())
Expand All @@ -434,7 +434,7 @@ fun destroyWindow(hWnd HWnd) Bool32 {

// TODO probably should be async post?
window.proc(hWnd, Message.WM_DESTROY, null, null)
window.proc(hWnd, Message.WM_NCDESTROY, null, null)
window.proc(hWnd, Message.WM_NC_DESTROY, null, null)
tofitaDebugLog("DestroyWindow done".utf16())
return Bool32.False // TODO false?
}
Expand Down
2 changes: 1 addition & 1 deletion kernel/gui/concepts/files.hexa
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ class Files {
return
}

if message.message == Message.WM_MOUSEMOVE {
if message.message == Message.WM_MOUSE_MOVE {
// Paint
let x = LParam.loWord(message.lParam as! UInt32)
let y = LParam.hiWord(message.lParam as! UInt32)
Expand Down
6 changes: 3 additions & 3 deletions kernel/gui/concepts/viewer.hexa
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ class Viewer {
Screen.height = window.height
Screen.pixels = window.fbZeta.pixels

if message.message == Message.WM_LBUTTONDOWN {
if message.message == Message.WM_L_BUTTON_DOWN {
// Clear
let color = new ByValue<Pixel32>()
color.ref.color = 0x33333333u32
Expand All @@ -147,7 +147,7 @@ class Viewer {
requestAnimationFrame()
}

if message.message == Message.WM_MOUSEMOVE and down {
if message.message == Message.WM_MOUSE_MOVE and down {
// Paint
let x = LParam.loWord(message.lParam as! UInt32)
let y = LParam.hiWord(message.lParam as! UInt32) - 32 // TODO window frame height
Expand All @@ -160,7 +160,7 @@ class Viewer {
requestAnimationFrame()
}

if message.message == Message.WM_LBUTTONUP {
if message.message == Message.WM_L_BUTTON_UP {
// Nothing
down = false
}
Expand Down
6 changes: 3 additions & 3 deletions kernel/gui/dwm.hexa
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ fun handleMouseMove(mouseX Int16, mouseY Int16) {
let payload = payload.ref
payload.hWnd = window.hWnd as! UInt64
// TODO RMB, MMB etc
payload.msg = Message.WM_MOUSEMOVE
payload.msg = Message.WM_MOUSE_MOVE
payload.wParam = null
payload.lParam = LParam.makeLong(mouseX - window.x, mouseY - window.y) as! UInt64
let process TofitaProcess = processes[window.pid]
Expand Down Expand Up @@ -420,7 +420,7 @@ fun handleMouseDown(type MouseActionType, mouseX Int16, mouseY Int16) {
let payload = payload.ref
payload.hWnd = window.hWnd as! UInt64
// TODO RMB, MMB etc
payload.msg = Message.WM_LBUTTONDOWN
payload.msg = Message.WM_L_BUTTON_DOWN
payload.wParam = null
payload.lParam = LParam.makeLong(mouseX - window.x, mouseY - window.y) as! UInt64
let process TofitaProcess = processes[window.pid]
Expand Down Expand Up @@ -496,7 +496,7 @@ fun handleMouseUp(type MouseActionType, mouseX Int16, mouseY Int16) {
let payload = payload.ref
payload.hWnd = window.hWnd as! UInt64
// TODO RMB, MMB etc
payload.msg = Message.WM_LBUTTONUP
payload.msg = Message.WM_L_BUTTON_UP
payload.wParam = null
payload.lParam = LParam.makeLong(mouseX - window.x, mouseY - window.y) as! UInt64
let process TofitaProcess = processes[window.pid]
Expand Down

0 comments on commit b4bd42f

Please sign in to comment.