[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/pgtk 8a649cb: Update texts while busy
From: |
Yuuki Harano |
Subject: |
feature/pgtk 8a649cb: Update texts while busy |
Date: |
Sat, 15 May 2021 09:55:25 -0400 (EDT) |
branch: feature/pgtk
commit 8a649cba44cc637b5326cee9fe3febc55c653719
Author: Yuuki Harano <masm+github@masm11.me>
Commit: Yuuki Harano <masm+github@masm11.me>
Update texts while busy
Pgtk didn't update text and C-g didn't take effect while it is busy.
By timer interrupts, we can call pgtk_read_socket, and update texts
and handle C-g.
* src/pgtkterm.c (start_timer): New function to start timer.
(pgtk_show_hourglass): Remove code to start timer.
(pgtk_hide_hourglass): Remove code to stop timer.
(pgtk_term_init): Call start_timer().
---
src/pgtkterm.c | 46 ++++++++++++++++++++++++----------------------
1 file changed, 24 insertions(+), 22 deletions(-)
diff --git a/src/pgtkterm.c b/src/pgtkterm.c
index 533b9ea..194a255 100644
--- a/src/pgtkterm.c
+++ b/src/pgtkterm.c
@@ -3551,12 +3551,31 @@ pgtk_draw_fringe_bitmap (struct window *w, struct
glyph_row *row,
}
static struct atimer *hourglass_atimer = NULL;
-static int hourglass_enter_count = 0;
static void
hourglass_cb (struct atimer *timer)
{
- /*NOP*/}
+ /*NOP*/
+}
+
+static void
+start_timer (void)
+{
+ static bool hourglass_inited = false;
+
+ /* For cursor animation, we receive signals, set pending_signals, and
dispatch. */
+ /* This is useful for drawing text while busy, and C-g takes effect while
busy. */
+ if (!hourglass_inited)
+ {
+ struct timespec ts = make_timespec (0, 50 * 1000 * 1000);
+ if (hourglass_atimer != NULL)
+ cancel_atimer (hourglass_atimer);
+ hourglass_atimer =
+ start_atimer (ATIMER_CONTINUOUS, ts, hourglass_cb, NULL);
+
+ hourglass_inited = true;
+ }
+}
static void
pgtk_show_hourglass (struct frame *f)
@@ -3572,32 +3591,13 @@ pgtk_show_hourglass (struct frame *f)
gdk_window_raise (gtk_widget_get_window (x->hourglass_widget));
gdk_window_set_cursor (gtk_widget_get_window (x->hourglass_widget),
x->hourglass_cursor);
-
- /* For cursor animation, we receive signals, set pending_signals, and
dispatch. */
- if (hourglass_enter_count++ == 0)
- {
- struct timespec ts = make_timespec (0, 50 * 1000 * 1000);
- if (hourglass_atimer != NULL)
- cancel_atimer (hourglass_atimer);
- hourglass_atimer =
- start_atimer (ATIMER_CONTINUOUS, ts, hourglass_cb, NULL);
- }
-
- /* Cursor frequently stops animation. gtk's bug? */
}
static void
pgtk_hide_hourglass (struct frame *f)
{
struct pgtk_output *x = FRAME_X_OUTPUT (f);
- if (--hourglass_enter_count == 0)
- {
- if (hourglass_atimer != NULL)
- {
- cancel_atimer (hourglass_atimer);
- hourglass_atimer = NULL;
- }
- }
+
if (x->hourglass_widget != NULL)
{
gtk_widget_destroy (x->hourglass_widget);
@@ -6995,6 +6995,8 @@ pgtk_term_init (Lisp_Object display_name, char
*resource_name)
unblock_input ();
+ start_timer();
+
return dpyinfo;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- feature/pgtk 8a649cb: Update texts while busy,
Yuuki Harano <=