[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 996daa00ae: Implement frame resize synchronization on GTK 3
From: |
Po Lu |
Subject: |
master 996daa00ae: Implement frame resize synchronization on GTK 3 |
Date: |
Tue, 8 Feb 2022 06:15:59 -0500 (EST) |
branch: master
commit 996daa00ae3cab514a0f9fca0ee8b108f220677e
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>
Implement frame resize synchronization on GTK 3
* src/xterm.c (XTframe_up_to_date):
(handle_one_xevent): Use the GTK frame clock to implement frame
resize synchronization.
* src/xterm.h (struct x_output): New variable
`xg_sync_end_pending_p'.
---
src/xterm.c | 45 +++++++++++++++++++++++++++++++++++++++++++--
src/xterm.h | 3 +++
2 files changed, 46 insertions(+), 2 deletions(-)
diff --git a/src/xterm.c b/src/xterm.c
index 8bdb3c9ea1..9b48006927 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -1848,10 +1848,14 @@ x_update_end (struct frame *f)
static void
XTframe_up_to_date (struct frame *f)
{
-#ifdef HAVE_XSYNC
+#if defined HAVE_XSYNC && !defined HAVE_GTK3
XSyncValue add;
XSyncValue current;
Bool overflow_p;
+#elif defined HAVE_XSYNC
+ GtkWidget *widget;
+ GdkWindow *window;
+ GdkFrameClock *clock;
#endif
eassert (FRAME_X_P (f));
@@ -1861,6 +1865,7 @@ XTframe_up_to_date (struct frame *f)
show_back_buffer (f);
#ifdef HAVE_XSYNC
+#ifndef HAVE_GTK3
if (FRAME_X_OUTPUT (f)->sync_end_pending_p
&& FRAME_X_BASIC_COUNTER (f) != None)
{
@@ -1892,6 +1897,20 @@ XTframe_up_to_date (struct frame *f)
FRAME_X_OUTPUT (f)->ext_sync_end_pending_p = false;
}
+#else
+ if (FRAME_X_OUTPUT (f)->xg_sync_end_pending_p)
+ {
+ widget = FRAME_GTK_OUTER_WIDGET (f);
+ window = gtk_widget_get_window (widget);
+ eassert (window);
+ clock = gdk_window_get_frame_clock (window);
+ eassert (clock);
+
+ gdk_frame_clock_request_phase (clock,
+ GDK_FRAME_CLOCK_PHASE_AFTER_PAINT);
+ FRAME_X_OUTPUT (f)->xg_sync_end_pending_p = false;
+ }
+#endif
#endif
unblock_input ();
}
@@ -9130,7 +9149,7 @@ handle_one_xevent (struct x_display_info *dpyinfo,
goto done;
}
-#if defined HAVE_XSYNC && !defined HAVE_GTK3
+#if defined HAVE_XSYNC
if (event->xclient.data.l[0] == dpyinfo->Xatom_net_wm_sync_request
&& event->xclient.format == 32
&& dpyinfo->xsync_supported_p)
@@ -9138,9 +9157,15 @@ handle_one_xevent (struct x_display_info *dpyinfo,
struct frame *f
= x_top_window_to_frame (dpyinfo,
event->xclient.window);
+#if defined HAVE_GTK3
+ GtkWidget *widget;
+ GdkWindow *window;
+ GdkFrameClock *frame_clock;
+#endif
if (f)
{
+#ifndef HAVE_GTK3
if (event->xclient.data.l[4] == 0)
{
XSyncIntsToValue (&FRAME_X_OUTPUT
(f)->pending_basic_counter_value,
@@ -9155,6 +9180,22 @@ handle_one_xevent (struct x_display_info *dpyinfo,
}
*finish = X_EVENT_DROP;
+#else
+ widget = FRAME_GTK_OUTER_WIDGET (f);
+
+ if (widget && !FRAME_X_OUTPUT (f)->xg_sync_end_pending_p)
+ {
+ window = gtk_widget_get_window (widget);
+ eassert (window);
+ frame_clock = gdk_window_get_frame_clock (window);
+ eassert (frame_clock);
+
+ gdk_frame_clock_request_phase (frame_clock,
+
GDK_FRAME_CLOCK_PHASE_BEFORE_PAINT);
+
+ FRAME_X_OUTPUT (f)->xg_sync_end_pending_p = true;
+ }
+#endif
goto done;
}
}
diff --git a/src/xterm.h b/src/xterm.h
index 854d87c83c..1ce3e7a6cf 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -822,6 +822,9 @@ struct x_output
bool_bf sync_end_pending_p : 1;
bool_bf ext_sync_end_pending_p : 1;
+#ifdef HAVE_GTK3
+ bool_bf xg_sync_end_pending_p : 1;
+#endif
#endif
/* Relief GCs, colors etc. */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 996daa00ae: Implement frame resize synchronization on GTK 3,
Po Lu <=