processing / processing/processing4
keyPressed() does not always fire after starting sketch
まだ誰も着手していません。
- 主要言語
- Java
- スター
- 497
- フォーク
- 183
- 平均マージ
- 4時間 39分
- マージ済み PR(30日)
- 3
説明
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.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
提供された最小スケッチを IDE から実行した場合と、Windows 上でエクスポートしたスケッチを実行した場合の両方で実行し、描画領域をクリックしなくても keyPressed() が直ちに発火するかをテストします。まず、スケッチの起動時の動作とウィンドウのフォーカス/表示状態の動作を比較し、報告されている workaround である surface.setVisible(true) も確認します。両方の場合で、起動直後からキーボード入力が確実に機能すれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- java
- 領域
- desktop
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100