suwako / UnixCalc アーカイブ

このリポジトリはアーカイブされています。読むだけで、プッシュやイシューの変更は出来ません。

÷と×ボタンの修正

諏訪子 <suwako@076.moe>、2026-01-17 23:58
コミット 78a1c061a7987b1210ccf177cd3aaa9ddf778a4d ・親 5f5f824 ・ファイルを見る

1個のファイル、+4 -1

変更 src/control.c
@@ -256,7 +256,6 @@
256256 if (!btn) return;
257257
258258 btn->pressed = 0;
259-
260259 XftDraw *backdraw = XftDrawCreate(ui->display, ui->backbuf,
261260 DefaultVisual(ui->display, DefaultScreen(ui->display)),
262261 DefaultColormap(ui->display, DefaultScreen(ui->display)));
@@ -275,6 +274,10 @@
275274 const char *label = btn->text;
276275 if (strcmp(label, "C") == 0) {
277276 clear_calculator(ui);
277+ } else if (strcmp(label, "×") == 0) {
278+ append_to_input(ui, '*');
279+ } else if (strcmp(label, "÷") == 0) {
280+ append_to_input(ui, '/');
278281 } else if (strcmp(label, "<") == 0) {
279282 curinput[--input_pos] = '\0';
280283 strcpy(ui->resLabel.text, curinput[0] ? curinput : "0");