diff options
| author | Yuuki Harano | 2021-06-18 23:08:54 +0900 |
|---|---|---|
| committer | Yuuki Harano | 2021-06-18 23:08:54 +0900 |
| commit | 11c835ea48b971faf21dd94e40721e9ed0a8265a (patch) | |
| tree | d58c4e5f4b0782678ccd28173f60048b47c58de5 /src | |
| parent | 3dbd3a87a1a81b7c70a1131563d9e5aee1d974d3 (diff) | |
| download | emacs-11c835ea48b971faf21dd94e40721e9ed0a8265a.tar.gz emacs-11c835ea48b971faf21dd94e40721e9ed0a8265a.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/pgtkterm.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/pgtkterm.c b/src/pgtkterm.c index 13bd442ad95..86074d010d6 100644 --- a/src/pgtkterm.c +++ b/src/pgtkterm.c | |||
| @@ -5381,12 +5381,24 @@ pgtk_handle_draw (GtkWidget * widget, cairo_t * cr, gpointer * data) | |||
| 5381 | 5381 | ||
| 5382 | static void | 5382 | static void |
| 5383 | size_allocate (GtkWidget * widget, GtkAllocation * alloc, | 5383 | size_allocate (GtkWidget * widget, GtkAllocation * alloc, |
| 5384 | gpointer * user_data) | 5384 | gpointer user_data) |
| 5385 | { | 5385 | { |
| 5386 | PGTK_TRACE ("size-alloc: %dx%d+%d+%d.", alloc->width, alloc->height, | 5386 | PGTK_TRACE ("size-alloc: %dx%d+%d+%d.", alloc->width, alloc->height, |
| 5387 | alloc->x, alloc->y); | 5387 | alloc->x, alloc->y); |
| 5388 | 5388 | ||
| 5389 | struct frame *f = pgtk_any_window_to_frame (gtk_widget_get_window (widget)); | 5389 | struct frame *f = pgtk_any_window_to_frame (gtk_widget_get_window (widget)); |
| 5390 | |||
| 5391 | /* Between a frame is created and not shown, size is allocated and | ||
| 5392 | * this handler is called. When that, since the widget's window is | ||
| 5393 | * NULL, we can't get f, pgtk_cr_update_surface_desired_size is not | ||
| 5394 | * called, and its size is 0x0. That causes empty frame. | ||
| 5395 | * | ||
| 5396 | * Fortunately since we know f in pgtk_set_event_handler, we can get | ||
| 5397 | * it through user_data; | ||
| 5398 | */ | ||
| 5399 | if (!f) | ||
| 5400 | f = user_data; | ||
| 5401 | |||
| 5390 | if (f) | 5402 | if (f) |
| 5391 | { | 5403 | { |
| 5392 | PGTK_TRACE ("%dx%d", alloc->width, alloc->height); | 5404 | PGTK_TRACE ("%dx%d", alloc->width, alloc->height); |
| @@ -6705,7 +6717,7 @@ pgtk_set_event_handler (struct frame *f) | |||
| 6705 | g_signal_connect (G_OBJECT (FRAME_GTK_WIDGET (f)), "map-event", | 6717 | g_signal_connect (G_OBJECT (FRAME_GTK_WIDGET (f)), "map-event", |
| 6706 | G_CALLBACK (map_event), NULL); | 6718 | G_CALLBACK (map_event), NULL); |
| 6707 | g_signal_connect (G_OBJECT (FRAME_GTK_WIDGET (f)), "size-allocate", | 6719 | g_signal_connect (G_OBJECT (FRAME_GTK_WIDGET (f)), "size-allocate", |
| 6708 | G_CALLBACK (size_allocate), NULL); | 6720 | G_CALLBACK (size_allocate), f); |
| 6709 | g_signal_connect (G_OBJECT (FRAME_GTK_WIDGET (f)), "key-press-event", | 6721 | g_signal_connect (G_OBJECT (FRAME_GTK_WIDGET (f)), "key-press-event", |
| 6710 | G_CALLBACK (key_press_event), NULL); | 6722 | G_CALLBACK (key_press_event), NULL); |
| 6711 | g_signal_connect (G_OBJECT (FRAME_GTK_WIDGET (f)), "key-release-event", | 6723 | g_signal_connect (G_OBJECT (FRAME_GTK_WIDGET (f)), "key-release-event", |