Skip to content

Commit

Permalink
Misc fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
serenity4 committed Jun 30, 2023
1 parent 56f1d66 commit 9c992dd
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/testing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
Translate mouse or modifier state into the corresponding XCB value.
"""
function state_xcb(event::Event)
is_key_event(event) && return state_xcb(event.key_event.modifiers)
is_button_event(event) && return state_xcb(event.mouse_event.state)
event.type in KEY_EVENT && return state_xcb(event.key_event.modifiers)
event.type in BUTTON_EVENT && return state_xcb(event.mouse_event.state)
0
end

Expand All @@ -27,10 +27,10 @@ function response_type_xcb(event::Event)
end

function event_type_xcb(event::Event)
is_key_event(event) && return xcb_key_press_event_t
is_button_event(event) && return xcb_button_press_event_t
event.type in KEY_EVENT && return xcb_key_press_event_t
event.type in BUTTON_EVENT && return xcb_button_press_event_t
event.type == POINTER_MOVED && return xcb_motion_notify_event_t
is_pointer_event(event) && return xcb_enter_notify_event_t
event.type in POINTER_EVENT && return xcb_enter_notify_event_t
event.type == WINDOW_RESIZED && return xcb_configure_notify_event_t
event.type == WINDOW_EXPOSED && return xcb_expose_event_t
error("No event type corresponding to $(event.type)")
Expand All @@ -45,8 +45,8 @@ function button_xcb(button::MouseButton)
end

function detail_xcb(wm::XWindowManager, event::Event)
is_button_event(event) && return xcb_button_t(iszero(event.mouse_event.button) ? 0 : log2(Int(event.mouse_event.button)))
is_key_event(event) && return PhysicalKey(wm.keymap, event.key_event.key_name).code
event.type in BUTTON_EVENT && return xcb_button_t(iszero(event.mouse_event.button) ? 0 : log2(Int(event.mouse_event.button)))
event.type in KEY_EVENT && return PhysicalKey(wm.keymap, event.key_event.key_name).code
event.type == POINTER_MOVED && return UInt8(XCB_MOTION_NORMAL)
event.type == POINTER_ENTERED && return XCB_ENTER_NOTIFY
event.type == POINTER_EXITED && return XCB_LEAVE_NOTIFY
Expand Down

2 comments on commit 9c992dd

@serenity4
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register()

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/86585

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.7.0 -m "<description of version>" 9c992dd6ab4761e50dc04fee1ae0dfc6dd0cdb94
git push origin v0.7.0

Please sign in to comment.