From: Po Lu Date: Sat, 21 May 2022 03:29:22 +0000 (+0800) Subject: Implement `display-monitors-changed-hook' on PGTK X-Git-Tag: emacs-29.0.90~1910^2~553 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=98163f48a081442616bf680be06cf51ab74b4681;p=emacs.git Implement `display-monitors-changed-hook' on PGTK * src/pgtkterm.c (pgtk_draw_glyphless_glyph_string_foreground): Pacify GCC 12. (pgtk_monitors_changed_cb): New function. (pgtk_term_init): Attach new signal handler. --- diff --git a/src/pgtkterm.c b/src/pgtkterm.c index b9d0b7b512e..71b5f23283c 100644 --- a/src/pgtkterm.c +++ b/src/pgtkterm.c @@ -1587,6 +1587,10 @@ pgtk_draw_glyphless_glyph_string_foreground (struct glyph_string *s) false); x += glyph->pixel_width; } + + /* Pacify GCC 12 even though s->char2b is not used after this + function returns. */ + s->char2b = NULL; } /* Brightness beyond which a color won't have its highlight brightness @@ -6163,6 +6167,20 @@ drag_data_received (GtkWidget *widget, GdkDragContext *context, gtk_drag_finish (context, TRUE, FALSE, time); } +static void +pgtk_monitors_changed_cb (GdkScreen *screen, gpointer user_data) +{ + struct terminal *terminal; + union buffered_input_event inev; + + EVENT_INIT (inev.ie); + terminal = user_data; + inev.ie.kind = MONITORS_CHANGED_EVENT; + XSETTERMINAL (inev.ie.arg, terminal); + + evq_enqueue (&inev); +} + void pgtk_set_event_handler (struct frame *f) { @@ -6458,6 +6476,10 @@ pgtk_term_init (Lisp_Object display_name, char *resource_name) dpyinfo->resx = dpi; dpyinfo->resy = dpi; + g_signal_connect (G_OBJECT (gscr), "monitors-changed", + G_CALLBACK (pgtk_monitors_changed_cb), + terminal); + /* Set up scrolling increments. */ dpyinfo->scroll.x_per_char = 1; dpyinfo->scroll.y_per_line = 1;