emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

feature/pgtk 11c835e 2/2: Fix a frame created without scroll/menu/toolba


From: Yuuki Harano
Subject: feature/pgtk 11c835e 2/2: Fix a frame created without scroll/menu/toolbar is empty
Date: Fri, 18 Jun 2021 10:14:22 -0400 (EDT)

branch: feature/pgtk
commit 11c835ea48b971faf21dd94e40721e9ed0a8265a
Author: Yuuki Harano <masm+github@masm11.me>
Commit: Yuuki Harano <masm+github@masm11.me>

    Fix a frame created without scroll/menu/toolbar is empty
    
    * src/pgtkterm.c (size_allocate): Get frame pointer through user_data.
    (pgtk_set_event_handler): Pass it.
---
 src/pgtkterm.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/src/pgtkterm.c b/src/pgtkterm.c
index 13bd442..86074d0 100644
--- a/src/pgtkterm.c
+++ b/src/pgtkterm.c
@@ -5381,12 +5381,24 @@ pgtk_handle_draw (GtkWidget * widget, cairo_t * cr, 
gpointer * data)
 
 static void
 size_allocate (GtkWidget * widget, GtkAllocation * alloc,
-              gpointer * user_data)
+              gpointer user_data)
 {
   PGTK_TRACE ("size-alloc: %dx%d+%d+%d.", alloc->width, alloc->height,
              alloc->x, alloc->y);
 
   struct frame *f = pgtk_any_window_to_frame (gtk_widget_get_window (widget));
+
+  /* Between a frame is created and not shown, size is allocated and
+   * this handler is called.  When that, since the widget's window is
+   * NULL, we can't get f, pgtk_cr_update_surface_desired_size is not
+   * called, and its size is 0x0.  That causes empty frame.
+   *
+   * Fortunately since we know f in pgtk_set_event_handler, we can get
+   * it through user_data;
+   */
+  if (!f)
+    f = user_data;
+
   if (f)
     {
       PGTK_TRACE ("%dx%d", alloc->width, alloc->height);
@@ -6705,7 +6717,7 @@ pgtk_set_event_handler (struct frame *f)
   g_signal_connect (G_OBJECT (FRAME_GTK_WIDGET (f)), "map-event",
                    G_CALLBACK (map_event), NULL);
   g_signal_connect (G_OBJECT (FRAME_GTK_WIDGET (f)), "size-allocate",
-                   G_CALLBACK (size_allocate), NULL);
+                   G_CALLBACK (size_allocate), f);
   g_signal_connect (G_OBJECT (FRAME_GTK_WIDGET (f)), "key-press-event",
                    G_CALLBACK (key_press_event), NULL);
   g_signal_connect (G_OBJECT (FRAME_GTK_WIDGET (f)), "key-release-event",



reply via email to

[Prev in Thread] Current Thread [Next in Thread]