summaryrefslogtreecommitdiff
path: root/src/xterm.h
diff options
context:
space:
mode:
authorPo Lu <luangruo@yahoo.com>2022-02-05 21:43:00 +0800
committerPo Lu <luangruo@yahoo.com>2022-02-05 21:43:00 +0800
commit9e420cd893f5507b9d7d3888c3a6d709aa45e6ff (patch)
tree5a2d71ce0f282e7732f2774324970f4147ae3e24 /src/xterm.h
parent63eab2948a23c6302308358472fb7f718759f67a (diff)
downloademacs-9e420cd893f5507b9d7d3888c3a6d709aa45e6ff.tar.gz
Add support for basic syncing with the window manager on resize
This is handled by GTK 3, so the code is disabled on that specific build. On other builds, this eliminates any unexposed part of a frame from showing up after a resize when `frame-resize-pixelwise' is t. * configure.ac: Check for the X Synchronization Extension if present. * src/Makefile.in (EMACS_CFLAGS): (LIBES): Add XSYNC_LIBS and XSYNC_CFLAGS. * src/xfns.c (append_wm_protocols): Declare `_NET_WM_SYNC_REQUEST' support if appropriate. (x_window): Adjust location of call to `append_wm_protocols' on Xt version to prevent it from being overwritten. (Fx_create_frame): Create basic counter. * src/xterm.c (XTframe_up_to_date): Set counter value to the one asked for by the window manager. (handle_one_xevent): Handle _NET_WM_SYNC_REQUEST. (x_free_frame_resources): Free frame counter if present. (x_term_init): Test for XSync and set fields accordingly. * src/xterm.h (struct x_display_info): New fields for XSync support and new atoms. (struct x_output): New fields for counter status. (FRAME_X_BASIC_COUNTER): New macro.
Diffstat (limited to 'src/xterm.h')
-rw-r--r--src/xterm.h29
1 files changed, 25 insertions, 4 deletions
diff --git a/src/xterm.h b/src/xterm.h
index 99d339e1f94..25ea257b518 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -99,6 +99,10 @@ typedef GtkWidget *xt_or_gtk_widget;
#include <X11/XKBlib.h>
#endif
+#ifdef HAVE_XSYNC
+#include <X11/extensions/sync.h>
+#endif
+
#include "dispextern.h"
#include "termhooks.h"
@@ -366,9 +370,9 @@ struct x_display_info
/* More atoms, which are selection types. */
Atom Xatom_CLIPBOARD, Xatom_TIMESTAMP, Xatom_TEXT, Xatom_DELETE,
- Xatom_COMPOUND_TEXT, Xatom_UTF8_STRING,
- Xatom_MULTIPLE, Xatom_INCR, Xatom_EMACS_TMP, Xatom_TARGETS, Xatom_NULL,
- Xatom_ATOM, Xatom_ATOM_PAIR, Xatom_CLIPBOARD_MANAGER;
+ Xatom_COMPOUND_TEXT, Xatom_UTF8_STRING,
+ Xatom_MULTIPLE, Xatom_INCR, Xatom_EMACS_TMP, Xatom_TARGETS, Xatom_NULL,
+ Xatom_ATOM, Xatom_ATOM_PAIR, Xatom_CLIPBOARD_MANAGER, Xatom_COUNTER;
/* More atoms for font properties. The last three are private
properties, see the comments in src/fontset.h. */
@@ -498,7 +502,8 @@ struct x_display_info
Xatom_net_wm_state_sticky, Xatom_net_wm_state_above, Xatom_net_wm_state_below,
Xatom_net_wm_state_hidden, Xatom_net_wm_state_skip_taskbar,
Xatom_net_frame_extents, Xatom_net_current_desktop, Xatom_net_workarea,
- Xatom_net_wm_opaque_region, Xatom_net_wm_ping;
+ Xatom_net_wm_opaque_region, Xatom_net_wm_ping, Xatom_net_wm_sync_request,
+ Xatom_net_wm_sync_request_counter;
/* XSettings atoms and windows. */
Atom Xatom_xsettings_sel, Xatom_xsettings_prop, Xatom_xsettings_mgr;
@@ -565,6 +570,12 @@ struct x_display_info
int xfixes_major;
int xfixes_minor;
#endif
+
+#ifdef HAVE_XSYNC
+ bool xsync_supported_p;
+ int xsync_major;
+ int xsync_minor;
+#endif
};
#ifdef HAVE_X_I18N
@@ -801,6 +812,13 @@ struct x_output
XFontSet xic_xfs;
#endif
+#ifdef HAVE_XSYNC
+ XSyncCounter basic_frame_counter;
+ XSyncValue pending_basic_counter_value;
+
+ bool_bf sync_end_pending_p;
+#endif
+
/* Relief GCs, colors etc. */
struct relief
{
@@ -963,6 +981,9 @@ extern void x_mark_frame_dirty (struct frame *f);
|| (FRAME_DISPLAY_INFO (f)->xrender_major > (major))))
#endif
+#ifdef HAVE_XSYNC
+#define FRAME_X_BASIC_COUNTER(f) FRAME_X_OUTPUT (f)->basic_frame_counter
+#endif
/* This is the Colormap which frame F uses. */
#define FRAME_X_COLORMAP(f) FRAME_DISPLAY_INFO (f)->cmap