summaryrefslogtreecommitdiff
path: root/src/pgtkterm.h
diff options
context:
space:
mode:
authorYuuki Harano <masm+github@masm11.me>2021-12-04 15:54:37 +0900
committerYuuki Harano <masm+github@masm11.me>2021-12-04 15:54:37 +0900
commit729311c22b230faab9f8714ca2b6cb8f73ac0737 (patch)
treea9fbddba89c584e5d962aee38096258c3f2c4729 /src/pgtkterm.h
parentf638541785f0641f3010fa9c4393a4c32710d47e (diff)
downloademacs-729311c22b230faab9f8714ca2b6cb8f73ac0737.tar.gz
Keep track of scale factor by atimer and recreate cairo_surface_t
Otherwise texts become blurry when a frame moved from 1x monitor to 2x monitor. I need GTK's such signal, but there isn't. Instead I watch frame's monitor's scale factor periodically. We can see blurriness for a short time, but it is gone soon. * src/pgtkfns.c (update_watched_scale_factor): New function to check scale factor and recreate cairo_surface_t if changed. * src/pgtkfns.c (Fx_create_frame): Initialize atimer. (Fx_show_tip): Add an argument. * src/pgtkterm.c (FRAME_CR_SURFACE_DESIRED_WIDTH): Move macros to pgtkterm.h (x_free_frame_resources): Free atimer. (size_allocate): Add an argument. (pgtk_cr_update_surface_desired_size): Add an argument. Recreate if it is true. * src/pgtkterm.h (struct pgtk_output): New members. (FRAME_CR_SURFACE_DESIRED_HEIGHT): Move macros from pgtkterm.c
Diffstat (limited to 'src/pgtkterm.h')
-rw-r--r--src/pgtkterm.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/pgtkterm.h b/src/pgtkterm.h
index c16221da832..e76411cf021 100644
--- a/src/pgtkterm.h
+++ b/src/pgtkterm.h
@@ -398,6 +398,13 @@ struct pgtk_output
frame, or IMPLICIT if we received an EnterNotify.
FocusOut and LeaveNotify clears EXPLICIT/IMPLICIT. */
int focus_state;
+
+ /* Keep track of scale factor. If monitor's scale factor is changed, or
+ monitor is switched and scale factor is changed, then recreate cairo_t
+ and cairo_surface_t. I need GTK's such signal, but there isn't, so
+ I watch it periodically with atimer. */
+ double watched_scale_factor;
+ struct atimer *scale_factor_atimer;
};
/* this dummy decl needed to support TTYs */
@@ -521,6 +528,10 @@ enum
(! (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (f)) ? 0 \
: FRAME_SCROLL_BAR_COLS (f))
+#define FRAME_CR_SURFACE_DESIRED_WIDTH(f) \
+ ((f)->output_data.pgtk->cr_surface_desired_width)
+#define FRAME_CR_SURFACE_DESIRED_HEIGHT(f) \
+ ((f)->output_data.pgtk->cr_surface_desired_height)
/* Display init/shutdown functions implemented in pgtkterm.c */
extern struct pgtk_display_info *pgtk_term_init (Lisp_Object display_name,
@@ -575,7 +586,7 @@ extern void x_set_z_group (struct frame *f, Lisp_Object new_value,
Lisp_Object old_value);
/* Cairo related functions implemented in pgtkterm.c */
-extern void pgtk_cr_update_surface_desired_size (struct frame *, int, int);
+extern void pgtk_cr_update_surface_desired_size (struct frame *, int, int, bool);
extern cairo_t *pgtk_begin_cr_clip (struct frame *f);
extern void pgtk_end_cr_clip (struct frame *f);
extern void pgtk_set_cr_source_with_gc_foreground (struct frame *f,