Skip to content

Commit c4466bf

Browse files
Jeff Walshfejfighter
authored andcommitted
End Resize flickering by copying surface rather than just clearing
1 parent 0183c38 commit c4466bf

File tree

1 file changed

+61
-10
lines changed

1 file changed

+61
-10
lines changed

src/pgtkterm.c

Lines changed: 61 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ pgtk_any_window_to_frame (GdkWindow *window);
9898

9999
static void flip_cr_context(struct frame *f)
100100
{
101-
APGTK_TRACE("flip_cr_context");
101+
PGTK_TRACE("flip_cr_context");
102102
cairo_t * cr = FRAME_CR_ACTIVE_CONTEXT(f);
103103

104104
block_input();
@@ -407,7 +407,6 @@ pgtk_set_window_size (struct frame *f,
407407
block_input ();
408408

409409
gtk_widget_get_size_request(FRAME_GTK_WIDGET(f), &pixelwidth, &pixelheight);
410-
PGTK_TRACE("old: %dx%d", pixelwidth, pixelheight);
411410

412411
if (pixelwise)
413412
{
@@ -428,18 +427,13 @@ pgtk_set_window_size (struct frame *f,
428427
make_fixnum (FRAME_PGTK_TITLEBAR_HEIGHT (f)),
429428
make_fixnum (FRAME_TOOLBAR_HEIGHT (f))));
430429

431-
PGTK_TRACE("new: %dx%d", pixelwidth, pixelheight);
432430
for (GtkWidget *w = FRAME_GTK_WIDGET(f); w != NULL; w = gtk_widget_get_parent(w)) {
433-
PGTK_TRACE("%p %s %d %d", w, G_OBJECT_TYPE_NAME(w), gtk_widget_get_mapped(w), gtk_widget_get_visible(w));
434431
gint wd, hi;
435432
gtk_widget_get_size_request(w, &wd, &hi);
436-
PGTK_TRACE(" %dx%d", wd, hi);
437433
GtkAllocation alloc;
438434
gtk_widget_get_allocation(w, &alloc);
439-
PGTK_TRACE(" %dx%d+%d+%d", alloc.width, alloc.height, alloc.x, alloc.y);
440435
}
441436

442-
PGTK_TRACE("pgtk_set_window_size: %p: %dx%d.", f, width, height);
443437
f->output_data.pgtk->preferred_width = pixelwidth;
444438
f->output_data.pgtk->preferred_height = pixelheight;
445439
x_wm_set_size_hint(f, 0, 0);
@@ -678,6 +672,63 @@ x_display_pixel_width (struct pgtk_display_info *dpyinfo)
678672
return gdk_screen_get_width(gscr);
679673
}
680674

675+
void
676+
x_set_parent_frame (struct frame *f, Lisp_Object new_value, Lisp_Object old_value)
677+
/* --------------------------------------------------------------------------
678+
Set frame F's `parent-frame' parameter. If non-nil, make F a child
679+
frame of the frame specified by that parameter. Technically, this
680+
makes F's window-system window a child window of the parent frame's
681+
window-system window. If nil, make F's window-system window a
682+
top-level window--a child of its display's root window.
683+
684+
A child frame's `left' and `top' parameters specify positions
685+
relative to the top-left corner of its parent frame's native
686+
rectangle. On macOS moving a parent frame moves all its child
687+
frames too, keeping their position relative to the parent
688+
unaltered. When a parent frame is iconified or made invisible, its
689+
child frames are made invisible. When a parent frame is deleted,
690+
its child frames are deleted too.
691+
692+
Whether a child frame has a tool bar may be window-system or window
693+
manager dependent. It's advisable to disable it via the frame
694+
parameter settings.
695+
696+
Some window managers may not honor this parameter.
697+
-------------------------------------------------------------------------- */
698+
{
699+
struct frame *p = NULL;
700+
int width = 0, height = 0;
701+
702+
PGTK_TRACE ("x_set_parent_frame x: %d, y: %d, size: %d x %d", f->left_pos, f->top_pos, width, height );
703+
gtk_window_get_size(FRAME_X_WINDOW(f), &width, &height);
704+
705+
706+
PGTK_TRACE ("x_set_parent_frame x: %d, y: %d, size: %d x %d", f->left_pos, f->top_pos, width, height );
707+
708+
if (!NILP (new_value)
709+
&& (!FRAMEP (new_value)
710+
|| !FRAME_LIVE_P (p = XFRAME (new_value))
711+
|| !FRAME_PGTK_P (p)))
712+
{
713+
store_frame_param (f, Qparent_frame, old_value);
714+
error ("Invalid specification of `parent-frame'");
715+
}
716+
717+
if (p != FRAME_PARENT_FRAME (f))
718+
{
719+
block_input ();
720+
gtk_window_set_transient_for(FRAME_X_WINDOW(f), FRAME_X_WINDOW(p));
721+
gtk_window_set_attached_to(FRAME_X_WINDOW(f), FRAME_X_WINDOW(p));
722+
gtk_window_move(FRAME_X_WINDOW(f), f->left_pos, f->top_pos);
723+
gtk_window_set_keep_above(FRAME_X_WINDOW(f), true);
724+
//fill this in
725+
unblock_input ();
726+
727+
fset_parent_frame (f, new_value);
728+
}
729+
}
730+
731+
681732
void
682733
x_set_no_focus_on_map (struct frame *f, Lisp_Object new_value, Lisp_Object old_value)
683734
/* Set frame F's `no-focus-on-map' parameter which, if non-nil, means
@@ -4807,9 +4858,9 @@ pgtk_handle_draw(GtkWidget *widget, cairo_t *cr, gpointer *data)
48074858
if (src == NULL && FRAME_CR_ACTIVE_CONTEXT(f) != NULL)
48084859
src = cairo_get_target(FRAME_CR_ACTIVE_CONTEXT(f));
48094860
}
4810-
APGTK_TRACE(" surface=%p", src);
4861+
PGTK_TRACE(" surface=%p", src);
48114862
if (src != NULL) {
4812-
APGTK_TRACE(" resized_p=%d", f->resized_p);
4863+
PGTK_TRACE(" resized_p=%d", f->resized_p);
48134864
PGTK_TRACE(" garbaged=%d", f->garbaged);
48144865
PGTK_TRACE(" scroll_bar_width=%f", (double) PGTK_SCROLL_BAR_WIDTH(f));
48154866
// PGTK_TRACE(" scroll_bar_adjust=%d", PGTK_SCROLL_BAR_ADJUST(f));
@@ -6600,7 +6651,7 @@ pgtk_end_cr_clip (struct frame *f)
66006651
void
66016652
pgtk_set_cr_source_with_gc_foreground (struct frame *f, Emacs_GC *gc)
66026653
{
6603-
PGTK_TRACE("pgtk_set_cr_source_with_gc_foreground: %08lx", gc->foreground);
6654+
PGTK_TRACE ("pgtk_set_cr_source_with_gc_foreground: %08lx", gc->foreground);
66046655
pgtk_set_cr_source_with_color(f, gc->foreground);
66056656
}
66066657

0 commit comments

Comments
 (0)