processing / processing/processing4
keyPressed() does not always fire after starting sketch
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Java
- Star
- 494
- Fork
- 183
- Merge trung bình
- 4 giờ 39 phút
- Pull request đã merge (30 ngày)
- 3
Mô tả
Created by: sterretjeToo
When starting a sketch from the IDE or running an exported sketch, it does not always react on keyboard input; sometimes one has to click inside the drawn area. So it looks like a started sketch does not have the focus; clicking on the titlebar in the window does not solve the issue.
The below sketch (running in the IDE) produces the issue (as said, it sometimes works correctly, sometime not).
void setup()
{
size(400, 200);
}
void draw()
{
}
void keyPressed()
{
println("keyPressed()");
}
Expected behaviour
The expected behaviour is that at the moment that the sketch runs and a key is pressed, the message "keyPressed()" shows.
System information
Second gen Intel I3 with 8GB memory and integrated Intel Graphics (AsRock H61M VS-R2.0)
Windows 10 Home
Processing 4.3; the issue was also observed in Processing 4.2)
Workaround
https://discourse.processing.org/t/keypressed-only-works-sometimes/22340 (July 1920) contains a (possible) workaround by using the below line in setup()
surface.setVisible(true);
For now, it seems to have solved the issue. I will provide feedback if I still encounter the issue with the above workaround.
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Chạy sketch tối thiểu được cung cấp từ cả IDE và sketch đã export trên Windows, kiểm tra xem keyPressed() có được kích hoạt ngay lập tức mà không cần nhấp vào vùng vẽ hay không. Trước tiên, hãy so sánh hành vi khởi động của sketch và hành vi focus/hiển thị của cửa sổ, bao gồm workaround surface.setVisible(true) đã được báo cáo. Được xem là hoàn tất khi thao tác nhập bằng bàn phím hoạt động ổn định ngay sau khi khởi chạy trong cả hai trường hợp.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- java
- Lĩnh vực
- desktop
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 35/100